Invoke Random function
actually my code is this
void OnTriggerStay (Collider other){
if (Input.GetButtonDown ("giallo")) {
murobase.SetActive (false);
muro_blu.SetActive (false);
muro_arancione.SetActive (false);
muro_giallo.SetActive (true);
} else {
if (Input.GetButtonDown ("arancio")) {
murobase.SetActive (false);
muro_blu.SetActive (false);
muro_arancione.SetActive (true);
muro_giallo.SetActive (false);
} else {
if (Input.GetButtonDown ("blu")) {
murobase.SetActive (false);
muro_blu.SetActive (true);
muro_arancione.SetActive (false);
muro_giallo.SetActive (false);
}
}
}
}
but i'd like to change the gameobjects with a only button, so I tried to do
void gialloON (){
murobase.SetActive (false);
muro_blu.SetActive (false);
muro_arancione.SetActive (false);
muro_giallo.SetActive (true);
}
void arancioneON(){
murobase.SetActive (false);
muro_blu.SetActive (false);
muro_arancione.SetActive (true);
muro_giallo.SetActive (false);
}
void bluON (){
murobase.SetActive (false);
muro_blu.SetActive (true);
muro_arancione.SetActive (false);
muro_giallo.SetActive (false);
}
void OnTriggerStay (Collider other) {
if (Input.GetButtonDown ("button")){
Invoke.... //i have to say,if you press button one time invoke void bluON, if you press another time invoke void arancioON, the tird time voidgialloON, and so on random, how can I do it?
}
Your answer
Follow this Question
Related Questions
What range of values need to be inserted if we need to pull a random item from the list? 0 Answers
Is it possible to make gameobject size around irregularly shaped .pngs? 0 Answers
Instantiated objects appear invisible. 0 Answers
Unity won't Instantiate PLEASE HELP! 1 Answer
How can I find a new position once the old one is found? 1 Answer