Scene loads in editor but not on Android build
I recently upgraded a Unity project from 4.6 to 5.3.1f1. Not unexpectedly, there were some issues involved in doing so. I have cleared up all of the errors and my project works fine in editor, however when I try to build to an Android device (Nexus 7 and Samsung Galaxy s5) the Game scene will not load.
I have a Splash Screen scene that loads into a Main Menu scene which works fine. Whenever I try to go from the Main Menu to a Game scene, the game completely freezes while still on the Main Menu. I have tried waiting several minutes to make sure it wasn't just taking forever to load. Tried out the profiling tool and it comes to a halt as soon as the Start button is pressed. I have disabled every game object in my scene individually and all at once and it still will not load.
I tried loading a new empty scene instead and that seems to work fine.
Really stuck on this and would appreciate any help!
Check if you've added all necessary scenes to the build settings. Then, if an empty scene loads, but the other one does not, then there must be something wrong with it. Are you using while loops? Did you move things that should be in Resources folders to somewhere else (made this mistake myself)? Have you tried running a Debug build and watch the console on the device?
Thanks for the reply!
All of the scenes are accounted for in build settings. No while loops that I can recall/find. I actually didn't have a Resources folder set up, but added one and threw all of my scenes in there...still no luck. I have tried a debug build and no errors show up. There are a couple warnings, but they are unrelated to the scene loading.
Answer by midgardweller · Mar 06, 2016 at 06:47 AM
I seem to have fixed the problem, though the answer doesn't really make sense to me. I traced the issue to a script that had a public AudioClip that was not being referenced anywhere in code. Commenting this out makes the scene load fine.
Strangely, there were no errors or warnings about the variable being assigned but never used or anything like it. Looks like Unity just failed silently specifically with building on Android.
Huh.
I had the same issue. After this example above, I decided to track back errors. I had one invisible due to internationalization. Thanks
Answer by dangerdex · Feb 08, 2017 at 08:18 AM
@midgardweller How did you diagnose this problem? I'm having a similar issue and wondering how you backtracked to find the underlying cause? Hoping I can repro your results.
Your answer
Follow this Question
Related Questions
Why is my scene loading differently on Android than other platforms? 0 Answers
How to load new scene contents based on a generated link from web? 0 Answers
LoadScene not working 0 Answers
obbdownloader relevance 0 Answers
Can not load the next scene 0 Answers