- Home /
 
Duplicate Question
Application LoadLevel() not working as expected
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. When I run the game scene from the editor everything works fine. What am I doing wrong?
My code pretty much is this:
   if (GUI.Button(new Rect(100.0f, 50.0f, 100.0f, 50.0f), "Play Defending"))
         {
             GameController.clientColour_ = PlayerEnum.Blue;
             Application.LoadLevel("gameScene");
         }
 
         if (GUI.Button(new Rect(210.0f, 50.0f, 100.0f, 50.0f), "Play Attacking"))
         {
             GameController.clientColour_ = PlayerEnum.Red;
             Application.LoadLevel("gameScene");
         }
 
 
              Follow this Question
Related Questions
asleep rigidbodys + async level load 0 Answers
Default string value... empty? (C#) 2 Answers
Application LoadLevel() not working as expected 3 Answers
Failed loading fbx Importer 3 Answers
How to wait until everything is loaded before starting? 7 Answers