SceneManager.LoadScene freezes in published build
Hi there!
I am having a weird issue. I have a scene that I use for loading levels. When my game loads, it plays a little intro video, then starts the loading scene which loads the level.
However, if I try to load a new level, the game just freezes and the level never loads. Even weirder, it works fine in the editor and crashes in published builds. It doesn't matter if the published build is development or release, it still crashes. I can't figure it out.
I also have an issue where if I try to load the scene asynchronously, it breaks, but again only in published builds. It works fine in the editor.
Any ideas?
Relevant Code:
loading scene
IEnumerator LoadLevel()
{
SceneManager.LoadScene(ApplicationModel.SceneToLoad, LoadSceneMode.Single);
Debug.Log("loading complete");
yield return null;
}
Update() in loaded level
if(PlayerInput.GetButtonUp("next_level"))
{
if(SceneManager.GetActiveScene().name == "SurfaceProTest")
{
ApplicationModel.SceneToLoad = "low_hanging_fruit";
}
else
{
ApplicationModel.SceneToLoad = "SurfaceProTest";
}
SceneManager.LoadScene("InitialLoadingScreen",LoadSceneMode.Single);
}
Some more details for anyone who might have insight:
When I connect the debugger to my build, when I attempt to load the new scene, it reaches the line of code that should load the new scene, but then it appears the Start() method is never called in the newly loaded scene, but it does get added to the Scene$$anonymous$$anager.GetAllScenes(). I tried creating a duplicate loading scene (IntitialLoadingScreenAlt) to see if maybe there was an issue unloading the original InitialLoadingScreen, but that did not work. It seems to fail at unloading my current scene. I am not sure what to make of it, but it is getting frustrating that it works in the editor and not in my player builds.
Hi there,
I think I am having similar issues. when you say your having issues in a published build are you referring to build and run? I am only having the issue when I download the game from the Google Play store. In editor and Build and run it works fine!
Same problem... do not use substance. Works in editor and crashes in build. It is a serious problem for me.
Answer by dotfortun3 · Jan 14, 2016 at 12:03 AM
Ok, I figured it out. If you are using substances (ProceduralMaterials), you can only use the materials that it generates. You cannot use the textures it creates to create more materials.
So only used these:
Do not create new materials with the textures:
I am not sure if that is me misusing the concept, or a bug in the application but I have remade all of the materials using only the ones that are actually generated by the substance and the game works fine now.
I hope this helps anyone else with the issue.
Great work, I $$anonymous$$AY be having this same problem. I also seem to be having a problem in the published game and during debug in Visual Studio 2015. When I press "Play" which should go to the next scene, my game freezes and the next level does not load.
Please explain more about substances (Procedural $$anonymous$$aterials) and how you made these, as I have noticed that when I import a material I also get a texture created automatically (or perhaps it is the other way around) and I never understood what is happening.
Answer by laurabaker · Mar 12, 2017 at 02:59 PM
I know this problem has long been answered but I spent a lot of time trying to fix this problem in my own app, so for the sake of any one else facing this issue, the cause in my scenario was:
Having set the "default icon" in player settings to be an image of my choosing. After setting this "default icon" back to "none" the app started to load scenes again.
Your answer
![](https://koobas.hobune.stream/wayback/20220612060016im_/https://answers.unity.com/themes/thub/images/avi.jpg)