- Home /
Scene random select
How can I select on of scenes? (scene names: cl_1, cl_2? cl_3, cl_4, cl_5) I tried all of this... http://forum.unity3d.com/threads/load-a-scene-randomly-out-of-a-list-of-scenes.55199/ http://answers.unity3d.com/questions/605457/random-scene-selection.html http://answers.unity3d.com/questions/257562/randomly-select-a-scene.html http://answers.unity3d.com/questions/598612/load-levels-randomly.html http://answers.unity3d.com/questions/800856/how-to-load-a-scene-level-randomly-without-repeati.html http://stackoverflow.com/questions/4950078/how-do-i-load-random-levels-in-unity-3d
Answer by Patrykgazing · Jan 31, 2015 at 04:56 PM
Application.LoadLevel("cl_"+Random.Range(1,5));
Is this helpful?
It is important to remember that Lists and arrays start from 0. So if you have your scenes stored in a List or Array, by using Random.Range(1,5) you'll be ignoring the first level. The correct way would be (0,5).