- Home /
Question by
omerbakrrr · May 25, 2020 at 02:24 PM ·
random.rangearray of gameobjects
Gameobject into arrays and choose someone in a random way,
Putting a lot of gameobject kids into a gameobject will randomly turn one of them around me, how can I do that the selected gameobject will become active,
Comment
Answer by KoenigX3 · May 25, 2020 at 02:59 PM
If by kids you mean there is a parent GameObject, and you want to activate one of its children randomly:
// I assume this script is on the parent GameObject.
transform.GetChild(Random.Range(0, transform.childCount)).gameObject.SetActive(true);
Your answer
Follow this Question
Related Questions
Need help with lightning randomization 2 Answers
onclick on random objects in gamemode and update score 1 Answer
Randomizing a selection from an array 1 Answer
Generate random no and active that GO using array 1 Answer
random issue 2 Answers