Before updating to Windows 10 you may need to return your Pro license. More information here

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);
 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..

more ▼

asked Jun 25, 2013 at 01:31 AM

avatar image

1 3 3 6

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first

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..

more ▼

answered Jun 26, 2013 at 12:17 PM

avatar image

1 3 3 6

(comments are locked)
10|3000 characters needed characters left
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Jun 25, 2013 at 01:31 AM

Seen: 1796 times

Last Updated: Jun 26, 2013 at 12:17 PM