I have 3 buttons if 1 is pressed it will get turned off and another one will randomly be selected and turned on, this works but i don’t want the same button to be turned on in a row how do i do this?
this is the script i used:
void Update ()
{
if(loop == true)
{
Invoke (“random”, 0f);
loop = false;
}
}
void random ()
{
index = Random.Range (0, buttons.Length);
switch (index)
{
case 0:
BS.button1 = true;
break;
case 1:
BS.button2 = true;
break;
case 2:
BS.button3 = true;
break;
}
}