- Home /
Android: Application.LoadLevel("level_name") does not do anything
I have a game with multiple scenes. Everything worked fine, in the Editor and on different Android devices. Then I changed some graphics today in one level, added a new texture to an object. Everything was fine in the Editor, then I wanted to finally see the result on the device, but I couldn't load the scene. I have one scene starting the game, showing a custom "splash screen" (since I don't have Android Pro). That scene automatically loads the second scene, the main menu. In that scene I select the level to load. (Btw that scene contained the new textures as a preview of the level I added the graphics to.) When I selected a level (doesn't matter which one, the one with the new textures or any other) the game freezes. I am loading the new scene with
Debug.Log("loading " + sceneToLoad);
Application.LoadLevel(sceneToLoad);
Debug.Log("loaded " + sceneToLoad);
The scene is definitely listed in the build settings. Both debug messages get called. But from then on everything just stops. Neither Update() from that script gets called nor anything in the new scene. The frame just freezes after that call. No other debug messages than mine get written to logcat. No error message from Unity. The time scale is 1, "Split Application Binary" is not checked. I even deleted the new textures, and the scene I added them to. I changed the scene order to load the main menu first. That worked, and I was able to load a level. But when I tried to load the splash screen scene, it froze again, without any error message from Unity. Then I tried to move the level to the "Resources" folder, which had absolutely no effect. Now I changed the scene order back, so that the splash screen scene is loaded first. Now the game even crashes right after the Unity logo with
06-24 18:39:42.343: W/Unity(24147): The referenced script on this Behaviour is missing!
06-24 18:39:42.343: E/Unity(24147): A script behaviour has a different serialization layout when loading. (Read 24 bytes but expected 32 bytes)
06-24 18:39:42.343: E/Unity(24147): Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
But no, I don't use preprocessor directives for properties. I also don't get the message that something is corrupt. I tried a development build, normal build, no difference. My APK is about 35MB big. I'm really desperate right now, because I don't have time for issues like that. That project is my bachelor thesis.. No matter what I try, I always get a similar result.
I just tried to change the package name and revert my project to the state that worked yesterday. It even worked! Then I made the changes with the new graphics and I got exactly the same issue. Unity won't load any level after the main menu. Does anyone have an idea? Sounds like a Unity bug when the engine stops doing anything without any output..
Answer by hicks · Jun 26, 2013 at 12:17 PM
Ok, seems like I solved it somehow. I reverted my project to the last working state (without the new graphics) and renamed the Android package. It worked again on my device. Then I repeated all my changes manually (adding the new graphics, changing materials and prefabs). But that cannot be the correct solution. Once published, you cannot change the package name anymore! I just hope this never happens again..
Answer by tungchengvn · Feb 25, 2016 at 08:38 AM
i have the same problem. After check the log in Debug build mode , I found that there are some warning with the shader: one shader for DX11 but my android device doesn't support.
'Hidden/CameraMotionBlurDX11' - Pass '' has no vertex shader02-25 14:53:04.901 28616-28658/com.deercat.infiniteflight D/Unity: WARNING: Shader
02-25 14:53:04.901 28616-28658/com.deercat.infiniteflight D/Unity: Unsupported: 'Hidden/CameraMotionBlurDX11' - Setting to default shader.
After remove that "CameraMotionBlurDX11" shader, my scene is load perfectly.
Your answer
Follow this Question
Related Questions
Android Button Text 1 Answer
Build error 2 Answers
Android game crash startup 0 Answers
load level on collision 2 Answers
How do I get the MainCamera to trigger application.loadLevel when it hits a collider? 2 Answers