c#


Vector 3 does only change x on first run in a for loop but not next time


I have this code here and down the line I'm spawning an object in a loop and in my heartGameobjectTempVec3 to dox -- .5316515f each time it loops.
Problems
It does change the valuable on the first time it runs the for loop. But does not change the x next time, but it does spawn the object again, now inside the just spawned object.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameUIManager : MonoBehaviour
{
public float heartGameobjectX;
public float heartGameobjectY;
public float heartGameobjectZ;
public int scoreCount;
public int lives;
public int liveCount;
public int dogsEscaped;
public GameObject[] spawnebleObjects;
public GameObject heartGameobject;
// Use this for initialization
void Start()
{
Vector3 heartGameobjectTempVec3 = new Vector3(heartGameobjectX, heartGameobjectY, heartGameobjectZ);
Instantiate(heartGameobject, heartGameobjectTempVec3, transform.rotation);
liveCount--;
for (int i = 1; i <= liveCount; i++)
{
heartGameobjectTempVec3[0] = -.5316515f;
Instantiate(heartGameobject, heartGameobjectTempVec3, transform.rotation);
}
}
}
I'm not shure, but you probably should do -=(or +=) there.
heartGameobjectTempVec3[0] -= -.5316515f;

Related Links

How do I set the Manager Attribute on the UserPrincipal object in Active Directory in C#
using PreSendRequestHeaders Event in global.asax
Assign to class property from XML randomly
Second Level Property Binding exception on Win XP(x86) OS but not Win 7(x64)
Support for multilanguage in ASP.NET
LINQ Select a List of List with DISTINCT
WPF 'Map' control; using canvas to display lots of bitmap images
Event accessing Bitmap while its locked
Is it possible to select the sum of a column, grouping by another column?
Get a File information that is open or not in physically path in asp.net C#
Exposing WPF control as ActiveX control
how to fill webGrid through dropdown selection in mvc 3?
Custom task framework
Why can this generic type not be converted?
Can I use NetUserGetInfo in C#?
Connecting to OLAP Cube via Silverlight

Categories

HOME
skype-for-business
ckan
google-cloud-pubsub
locale
fortran
weblogic
snappy
phantomjs
crash
sdk
box-api
subprocess
ethereum
gcloud
fetch
mamp
expo
android-notifications
template10
virtuemart
orange
google-street-view
webgl-earth
ng-tags-input
jira-zephyr
kundera
jmsserializerbundle
login-required
ios-autolayout
tikz
kubectl
jcr
circle
dom4j
rtsp
area
instances
mediastream
lfe
ssdp
redbean
binary-decision-diagram
encoder
qtwebkit
cancan
riemann
fluent-nhibernate-mapping
business-catalyst
suitesparse
directinput
turbolinks
altova
konakart
recurring
kik
django-taggit
usps
treelist
stdlist
web-performance
gnu-sort
sdkman
javapackager
vanilla-forums
winforms-interop
joomla3.3
pagecontrol
euro
vspackage
page-refresh
nfa
strcpy
pymol
xmla
backtrace
static-files
mind-manager
gnip
im4java
msdropdown
visual-c#-express-2010
ant-contrib
new-operator
elixir-framework
data-layers
aspnet-compiler
ironworker
wpa
backbone-views
google-checkout
outlook-object-model
idoc
flatten
apache-commons-email
backlight
javah
fxcopcmd
miniport
scala-designer
zend-acl

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App