I am working with Unity3d to create an iPhone game. Because iPhone is highly limited in performance than PC, I want to keep things economic. In my game I have a very long stairway and there is a character walking on it. If the character is above one step some height, the step will be destroyed. But i could not get a reference to a single gameObject. How could I achieve this? Thank you very much!
function buildFirstStair () {
for (var y = 0; y < 80; y++) {
for (var x = 0; x < 80; x++) {
if (x == y) {
var step = Instantiate(cube, Vector3(0, x*0.25, y*0.25), Quaternion.identity);
}
}
}
}
You can put all instance in a List, and delete them after.
Something like:
And to delete you do something like
Sorry for c# code but I’m a c# user.