I have a quick prototype that I’ve whipped up in Unity but I’m having issues with scene transitions. I have a Game Scene and a Start Scene, akin to those flash game loading screens that have instructions or whatever. The issue I’m having is when I use Application.LoadLevel to load the game scene from the starting scene, game objects don’t seem to be initialized and my game crashes with null exceptions. When I run the game scene from the editor everything works fine. What am I doing wrong?
To have objects persist between scenes you need to use Application.LoadLevelAdditive. Your null reference exceptions are likely coming from GameController not persisting.
You have to wait till the next frame before you can access the loaded level objects and properties.
You can do that in a coroutine :
Enumerator LoadLevelRoutine(string levelName)
{
Application.LoadLevel(levelName);
yield return null; // let a frame pass
// now you can access the scene objects and properties
}