I have about 10 scenes in my project. Scene switching is done using buildIndexes. How do I change the startup scene without having to rewrite all of my scene switching code ? (since changing the scene hierarchy would shift all scene indexes by one.. I know that I could make some calculations to account for that but is that really necessary ?) Thanks
Don't switch scenes using build indexes! The startup scene is always scene 0. Nothing you can do about that. Loading scenes by name is much easier - you don't have to look in the build index to change level correctly. Actually, don't every use build indexes for anything. They're incredibly brittle.
You can also try the https://docs.unity3d.com/ScriptReference/RuntimeInitializeOnLoadMethodAttribute.html with the before scene loaded argument to forcibly load your scene. I used it like this before and it worked fine.
//What is the other unique scene identifier? - nvm remembered about Unity using strings to identify. Also just notices this is obsolete: https://docs.unity3d.com/ScriptReference/Application.LoadLevel.html Can I get an alternative real quick?
Code (CSharp): SceneManager.GetActiveScene().whateverYouWantToGet; //- > variables are there for you including name, id, all you need. What I did for my game, that a lot of people don't prefer, is I created my own global non-destructible game object with a script that manages scene data. That way you can also make that global object's script hold the game menus, player data and display and manage saving and loading screens. You're managing then global and local data, the global data is managed by the persistent main game object, and the local data includes scene scripts. It can take a while to set up, but if you can get scene ping pong going so to speak you've gotten pretty far.