I want to do some logic in a script’s Start() depending on which scene it’s GameObject is in.
However, Start() is called before the scene is set to active, so I cannot use if(!SceneManager.GetActiveScene().name.Equals(Constants.SCENE_MAIN)).
That’s a pity. If there really isn’t a way of delaying the calls, I wonder if you would be left with having to keep track of your own ‘current scene’ and refer to that rather than through the Unity API?
I think I might have figured out a solution that will work for me. I put all GameObjects in a Parent-Object with a Script referencing the scene name (manually input via inspector). Then I use transform.root and get the referenced Scene
Another way is to change all the interesting Start’s to hand-called public inits(). After your waiting for the load is done, you can hand-set whatever you need to, in the new scene, then call init() on them all.
It’s a small pain, but it also makes it so you don’t have to play with script execution order, since you call the init()s in whatever order you want. It’s a “hammer” solution in that it’s not pretty and won’t impress anyone with clever use of Unity features, but it always works.