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

winform program not able to read data from sql
Changing Projects Provider from Firebird to Borland returns null command
Error “The remote server returned an error: (400) Bad Request”
XML replace invalid characters with c#
Cannot find elements within a div tag - Selenium
Strange characters reading PDF with iTextSharp
Multiple LeftJoin on same ForeignTable using Linq to Entities
adding class library to web application with net core
C# exchange server get meeting room appointment list
C# capture process network traffic
Synchronously calling async method in WebAPI deadlocks even with ConfigureAwait(false)
Make Visual Studio 2013 Setup Wizard Project to point Net framework 4.0
C# CefSharp enables flash play local mp4 video
How does `Convert.ToBase64String()` work? [closed]
Trying to get a list of “tables” in an excel document
Disable background untill form disspeares [duplicate]

Categories

HOME
c#
oauth-2.0
asterisk
airflow
joomla
ssms
msbuild
model-view-controller
oracle-sqldeveloper
openacc
abc
xamarin.forms
latex
highmaps
snmp
msbi
country-codes
open-search-server
clip-path
revit-api
promotions
ionic-native
runtime
apache-httpclient-4.x
mongoimport
mamp
responsive
k-means
ibatis
geography
dev-c++
angular2-pipe
uipath
handle
jira-zephyr
datanucleus
pydub
cloudformation
uibarbuttonitem
2checkout
undo
ios-autolayout
keil
circle
jsonapi-resources
headphones
android-databinding
anypoint-studio
redhat-brms
framebuffer
keychain
susy
android-graphview
compiler-warnings
amazon-rds-aurora
pexpect
logan-square
mef
google-chrome-storage
opos
confluent
stanford-nlp-server
vertex
dynamic-linking
bioperl
r-commander
totalview
rmq
esprima
networkstream
innertext
abstract
skbio
persian
om
avrcp
transparentproxy
log-analysis
tinymce-plugins
avd
touch-typing
report-builder2.0
powerpoint-2010
dotcmis
time-frequency
fastcgi-mono-server
boofcv
logo-lang
lastinsertid
ardor3d
fade
source-depot
panelgrid
uikit-dynamics
nx
vline
moonscript
netbiscuits
bash4
facebook-winjs-sdk
idtabs
joomla1.7
wdm
auto-compile
functional-specifications
meego-harmattan
hs-err
fxcopcmd
lgpl
mediastreamsource
browser-state
morfik
cons

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