hi, i have a problem with assigning arrays with for in loops. I'm going to make PlayerPrefsX.SetVector3Array with this. How to make it saves / assign the Arrays of Vector3 in RegSaver Vector3 arrays (which saves the arrays) ? But, when i'm trying to make the for(var om in rs.objPos) transform.position = om; and yea it's really does working but when i check the RegSaver arrays, all values of Vector3 were same. You know what i mean right ? Please. thanks for the read
this is my script. (objects.js) rs is RegSaver;
Well, this is all very well- but what do you really expect?
will always return one value, and by the looks of things you are iterating through an array and setting every single member of the array to the same thing! If you look at the Update function, you'll see that every single frame you overwrite the entire array with a single value. Why do you expect transform.position to return something different in every iteration?
Of course, even the other end of the system is flawed. When you read the values back out again, even if the array has a lot of different values in it, only the last one will make any difference! Because you're setting 'transform.position', none of the previous iterations will be remembered outside of the loop! Only the last one actually matters.
So, unless there's something you're not telling us about what this script is supposed to do, I'm not really sure how you could expect it to do anything different!
answered Jan 12 '12 at 10:22 AM