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

JIRA REST API Issue creation
SQLite keeps locking my database when doing SELECT + UPDATE (C#)
Autocomplete ComboBox only displays the first letter when I try and type in it
Grouping multiple winforms components
Wrapping a Mutex with IDisposable and testing it but the test never ends
Background worker c# stop worker - immediately (include Thread.Sleep in DoWork)
Web Api 2.0 OAuth 2.0 Testing with Postman
IMobileServiceSyncTable Incremental PullAsync - No Results
How to abtract DBMS requests in a .NET program, while being able to alter database during runtime
Anonymous method in static class is non-static? How to invoke it?
Upload file to Google Drive with C#
Can title of browser be changed in selenium c#?
Having an issue while binding data to gridview
How can i get a collection of child elements - query returns null using Xdocument
Database definition for Identity User - dbo.AspNetUsers and dbo.Users
c# select query to Oracle database throws “Custom type mapping for … is not specified or is invalid”

Categories

HOME
asp.net
skype-for-business
youtube-api
kendo-ui
stanford-nlp
intellij-idea
salesforce
pyspark
qemu
cluster-analysis
c++builder
conceptual
pandoc
squeak
mingw
symfony-sonata
thermal-printer
css-selectors
kohana
jquery-select2
osx-yosemite
ionic-native
pyodbc
digital
tmux
yui
civicrm
autologin
glibc
dev-c++
waterfall
inspec
paper-trail-gem
lines
akamai
rtos
flickr
incapsula
intersection
cache-control
mongoid5
const
libconfig
mediastream
cowboy
fisheye
compiler-warnings
inner-join
reqif
line-endings
infovis
google-chrome-storage
rivets.js
noise
serialversionuid
ear
grib
chain
glade
settext
networkstream
instaparse
recurring
database-administration
angular-i18n
periodic-processing
firefox-os
persian
fileinputstream
screen-lock
beagleboard
quickfixn
cordova-3
register-allocation
sync
time-frequency
telerik-appbuilder
pyalgotrade
imaplib
xml-validation
outlook-object-model
biztalk-deployment
quit
correctness
expresso-store
beep
recess
jquery-click-event
n2
chars
simultaneous
large-data-volumes
file-storage
onresize
high-load

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