Vector4 values disappearing from Array, Unity C# bug?

I’ve been struggling with what almost seems like a potential bug with C# and Unity. I’ve built an array of Vector4’s that is 16 items in length. I assign the values to each position in the array from 0 to 15. Later on, I call the index position of the item I need within the array bounds, only to find that the Vector4 values have been reset to zero. This is done all from within the game gameobject, same script, it has not been reset/modified/disabled in any way.

This doesn’t make sense to me because the only place in the script where the Vector4 values are set is within void Start(). They are not modified anywhere else. After Start() I’ve gone through a for loop to print each item from the array to ensure they are actually set, which they are because you can see the values printed to console. Nonetheless, when I call them after this, it’s as if they were never set and it’s driving me crazy. I’ve gone through my code for over an hour ensuring the array isnt being modified anywhere else.

Has anyone else had similar behaviour with Unity and C#? This seems like some sort of memory bug.

Vector4[] poolPositionArray = new Vector4[16]; 

void Start()
{
    for(int i = 0; i < poolPositionArray.Length; i++)
    {

       [...]
       poolPositionArray *= new Vector4(topLeftX, topLeftY, bottomRightX, bottomRightY);*

Debug.Log (“Pool index #”+i+" is positioned at "+poolPositionArray*);*
}
}
void OnClick()
{
for (int i = 0; i < poolPositionArray.Length; i++)
* { *
_ Debug.Log (“Pool index #”+i+" is positioned at "+poolPositionArray*);
}
}*_

I think from a probability point of view, it’s unlikely to be a bug in Unity. I think it’s easiest for you to debug this yourself. Try to determine the exact moment in script when the array goes from containing members to containing nothing; use the Monodevelop debugger to do this. But before you do that, be sure to check that your array is populated correctly before that code block ends, by printing its objects directly; e.g.

Debug.Log( poolPosition.ToString() )