at the moment i am testing arrays for a turn based style game but i cant get the hang of object arrays, how do you get an object into an array iv made some objects in my hierarchy but i can seem to get them into arrays do they need to be prefabs to go into arrays
so far iv got this
You need to add the values to the array, im a bit rusty on Javascript so I will try my best to show you.
//Declare the array and make it a float
var aFloat: float[];
function Start () {
//Initialize it
aFloat = new float[5];
}
function OnGUI(){
if(GUI.Button(Rect(10,10,100,50),"Click")){ Debug.Log("next step");
}
//Add to the 1st slot of the float (Which is always 0) so in this case this float
//will be from 0-4.
aFloat[0] = 1.2;
}
If you explain what you are trying to do and what X1, X2 are I can give you a much better example.