- Home /
Changing scenes without a new script?
Is there a way to to change the scene without having to write a new script for each one? When you change scene you would normally use
Application.LoadLevel("levelname")
However, this requires you to change the script for each and every level. Let's say you wanted to have 50 levels, and you wanted to go through them one-by-one, never going back to a previous level. Is there a way you could make an order for them, and say once you complete a level, go to the next one in the list?
Thanks!
Answer by meat5000 · Oct 08, 2015 at 12:29 PM
How about
http://docs.unity3d.com/ScriptReference/Application-loadedLevel.html
Application.LoadLevel(Application.loadedLevel + 1);
Just load by index, not name.
That's just about what I was thinking of, but I thought it wouldn't work like that. Thanks!
You can either use level name or index (which is found when you add a scene to build menu).
Click the tick to accept the answer :)