Categories
How to spawn any number of objects by prefab?
I need to spawn a RANDOM number of prefab objects on each new scene start, and have them in the list.
Answer the question
In order to leave comments, you need to log in
[SerializedField] private GameObject prefab; Start() { var rand = UnityEngine.Random.Range(5,50); for(int i=0;i<rand;i++) { GameObject go = Instantiate(prefab); } }
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question