In my game, I am creating many GameObjects in a 3 dimensional array like this:
internal var chunks : GameObject[,,];
Now I want to put a variable into each game object. For example:
chunks[1,0,3].newvariable : int = 4;
In this case, I want to create a variable called "newvariable" into that particular gameobject.
I also want to be able to access the variable later, like this:
print(chunks[1,0,3].newvariable);
This code doesn't work, so Im asking for your help to do this correctly. Can anyone help me accomplish this?
↧