Is there a way to generate a list of all available scenes in a project?
Not that I know of directly.
You can also know which scene you are at actually and store the scenes inside an array.
Application.levelCount will return the number of levels there is available. I don’t think you can get the names of the levels without actually being in them ![]()
As scenes are just strings (even to the build player mechanisms as you see in the build player docs), you would basically have to iterate physically through the whole asset folder and get all scenes.
So just recursively looping through all directories in the Assets folder and just pull the names of files ending in .unity is the easiest option?
The thing is that we cannot know the actual scene order while doing that.
Someone suggested it on Feedback, but it seems that wasn’t very popular even if it would be really handy!
I needed to do this as well so I just kept an array of the level names inside a gameObject that I set to not be destroyed on load. I had 120 levels so I also created an editor script that would add all the levels to the array.
How do you maintain the scenes order?