I'm working on what is intended to be an arcade-style, simple, streaming web game. When the last level is reached, I want to be able to reload the first (with a difficulty modifier, of course) and continue play. Each level is its own scene and I'm having no problems loading the next level until I reach the last one.
I'm unable to find any way to programmatically determine when I'm out of scenes. Since I can't tell when I run out, I can't tell when I need to go back to the first one. The current code I have to load the next level is:
if(Application.CanStreamedLevelBeLoaded(LevelNumber.ToString()))
Application.LoadLevel(LevelNumber.ToString());
Where `LevelNumber` is an `int` representing the level number to load next. Is there a way to check is a Scene with a given name exists within the Project so I can set `LevelNumber` back to 1 when I have no more available levels?
I am aware that I could set another variable representing the maximum number of levels there are but I'd prefer to have the program itself handle it so I can include or exclude levels for various builds (for testing and otherwise) without having to remember to change a game constant.