Hi, Could someone please tell me how to make a random player generator button? So I’m making a game that currently can be played with 5 players, but I’m thinking of adding a “?” random button which selects any player from that 5 player list. I’ve searched everywhere and cannot find a good answer. If anyone could help that would be great!! Thanks
To select a random object from a list of objects,
create the list:
public List players;
fill it inside the editor.
Select one, using the Random Class.
GameObject randomPlayer = players[Random.Range(0, players.Count)];