- Home /
ASDAsdASDasdqweqw3edqwdQWDEqwedQWD
QWDqwdqwd
Where is my answer you write wrong code, why are you delete my answer?
Why not help us help you, by posting the error you're getting in the console? I can tell you though, transform.position is a Vector3, not an integer.
The answer to your problem is in my answer I gave 2h ago.
if(array[i].transform.position = 0)
Is wrong. A position cannot be a float.
yes i understood this but i want to know how exactly i can replace my if statement? thanks
Answer by fafase · Jan 31, 2014 at 05:09 PM
Inside your if statement you are assigning and not comparing. Still, you cannot compare a float with 0 since a float has little chance to be exactly 0. You should either round it or then check if the value is near 0.
Answer by alaarhouma · Jan 31, 2014 at 05:40 PM
can you give me an example how to do that. im pretty new using unity 3d and i was wondering if array.RemoveAt(i); or its array.RemoveAt(i--); because the index needs to stay in the same place. thank you for your swift reply
Answer by Vardan Meliksetyan · Jan 31, 2014 at 06:17 PM
for (i = 0; i <= array.Length; i++) {
if (array[i].transform.position = 0)
array.RemoveAt(i);
**Look this code you are deleting i array.RemoveAt(i); element after that you are calling that element,
print(“Removed element: “ + array[i].name);
but that element does not exists !:)**
print(“Removed element: “ + array[i].name);
else if (array[i].transform.position > 0)
array[i].transform.forward = Vector3(1,0,0);
}
Your answer
Follow this Question
Related Questions
Show activity indicator in center of screen 0 Answers
whole animation not being played 0 Answers
Create Circular Motion to follow the object 2 Answers
colliders with touch 0 Answers
turn on off particle system 1 Answer