- Home /
Unity Array.Length Bug/Problem?
Hello guys,
I've got a kinda weird problem. I created an array like this:
public float[] xpos = {-0.4121904f, -0.2455676f, -0.0693534f, 0.1025528f, 0.2694485f, -0.5368412f, 0.6039026f};
It should contain 7 numbers, but it appears that Unity won't adress or count the last 2 numbers. Am I something missing or is this a bug?
do a debug
for each (float number in xpos) { debug.log (number); }
make sure its actually not got them all and your simply not failing to access them all.
Answer by supercouge · Jul 09, 2013 at 12:55 PM
How did you checked the number of element? Debug.Log(xpos.Length)?
Since the var is public, did you also modified the default array's values in the inspector? It may be the solution.
Oh, you are right, Unity changed it in the inspector automatically to a lenght of 5 :/
Thx for the fast help