Quantcast
Channel: Latest Questions by esitoinatteso
Viewing all articles
Browse latest Browse all 92

Standalone build fails Application.LoadLevel() and Freezes

$
0
0
Hi there again! I've tracked down another bug of a line that worked fine in editor and, for some reason, it does it wrong in the build. Here's the chunk of code from the scene named **VeryFirstSceneEver**, I'll provide an overview about what's happening nearby it so you can have an idea: /// /// Moves to Quit OR ProtoMenu! /// void MoveOn(){ //Once rendering is over... if(textBehaviour.Rendered){ //If user refuses... if(responsibilityRefused){ Application.Quit(); } else{ //Go cat go! if(Input.anyKeyDown){ Application.LoadLevel("ProtoMenu"); // StartCoroutine("LoadNext"); } } } } // IEnumerator LoadNext(){ // // Debug.Log("Trying to load ProtoMenu, hope this works"); // // yield return new WaitForSeconds(1f); // // line above is the last thing that gets processed, we never reach the one below. // Application.LoadLevel("ProtoMenu"); // Debug.Log("The call is passed, let's see the effects!"); // } I've tested with Debugs both from editor and from build, the results are: Editor loads the scene called ProtoMenu every time, both with the Coroutine method ( that I dislike) and the straight one. Build fails at loading ProtoMenu, and stops giving me feedback as soon as Input.AnyKeyDown is true ( I placed inside it a Debug and I never heard of it), or as soon as yield returns with the coroutine method... Or I should say as soon as 1 second from the start of the coroutine is through. **Now a bonus thing:** Even if I can't leave this scene without freezing, before I call Application.LoadLevel() I create a couple of Directories against which the Preloading Scene of Unity does this check: if(Directory.Exists(Application.persistentDataPath + "/Scenes Directory")){ Application.LoadLevel("ProtoMenu"); } else{ Application.LoadLevel("VeryFirstSceneEver"); } Since those Directories are there, the next time I launch the Build, the first condition is used. And the first condition loads ProtoMenu scene without a line of warning. But then a similar pattern occurs: I have to load a 3rd scene from the 2nd scene loaded since game's launch. *Guess what?* the game freezes for each once again. That's what makes me believe that something is jamming with Application.LoadLevel(); Thanks a bunch for any suggestions!

Viewing all articles
Browse latest Browse all 92

Trending Articles