pick random game object from list unity code example
Example: choose random gameobject from a gameobject list
void Fire()
{
if(Logs.Count == 0)
{
CancelInvoke();
return;
}
int randomIndex = Random.Range(0, Logs.Count);
Logs[randomIndex].transform.position = transform.position;
Logs[randomIndex].transform.rotation = transform.rotation;
Logs[randomIndex].SetActive(true);
Logs.RemoveAt(randomIndex);
}