Hi guys,
I’m trying to write a simple script that hide randomly a single of three object every random time. This is my script but it doesen’t work (if I cancel from the line var hideObject= arr[numeroRandom]; it work’s). Thanks in advance!
static var arr = new Array ();
function Start () {
arr[0] = "object1";
arr[1] = "object2";
arr[2] = "object3";
var esagono = GameObject.Find("ingame_object1");
var triangolo = GameObject.Find("ingame_object2");
var quadrato = GameObject.Find("ingame_object3");
object1.renderer.enabled = false;
object2.renderer.enabled = false;
object3.renderer.enabled = false;
}
function Update () {
var randomNumber: int = Random.Range(0,2);
var hideObject= arr[randomNumber];
hideObject.renderer.enabled = true;
yield WaitForSeconds(Random.Range(0,5);
}