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(SceneManager.GetActiveScene().name == "SurfaceProTest")
                ApplicationModel.SceneToLoad = "low_hanging_fruit";
                ApplicationModel.SceneToLoad = "SurfaceProTest";

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.

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.