How can I set a random ui object active from a list of ui objects on button click then reset the list so that if i click again it will activate another random ui object? So basically im making a chest reward on the ui and the player can click on the chest image to open it then I set active a random ui object from a list and that rewards them. But after that if the player clicks the chest button again the same ui object pops back up because its already set active. I want it to where if the player clicks the chest button again i need another random ui object from the list to activate. Thanks for the help
How can I set active a random Ui object from a list on a button press then reset it after the button pressed?
private List activeUIobjects = new List();//this is just in case you want to desactivate it
private List inactiveUIobjects = new List();//fill your list
public void ActivateRandom()
int random = Random.Range(0, inactiveUIobjects.Count);
Not tested but should work