0
\$\begingroup\$

In my level selection screen, all but the first level start out locked.

When I click on a level, it loads perfectly in Unity editor. However, when I build the game on a real device, the game stops as though I had pressed the back button on my device instead of launching the level.

What happened? How can I debug this, given it works fine in the editor?

\$\endgroup\$
  • \$\begingroup\$ Are your levels different scenes? \$\endgroup\$ – MichaelHouse Apr 14 '14 at 13:43
  • \$\begingroup\$ Yes they are different scenes ! \$\endgroup\$ – Adnan Nazir Apr 14 '14 at 13:44
  • \$\begingroup\$ Make sure you don't have any exceptions being thrown in the editor. Also check out this: klonk-games.de/2013/11/tips-android-development \$\endgroup\$ – Tetrad Apr 14 '14 at 16:30
3
\$\begingroup\$

When building your game, Unity will not include all the scenes by default. Ensure that your scene is included and checked in the build window. The build settings window appears after selecting build and displays the currently selected scenes to be built. You can also find it by selecting File->Build Settings. You may need to add the scenes yourself and then ensure they're checked to be included in the build.

\$\endgroup\$
  • \$\begingroup\$ Every scene is included. I have double checked that. If that the case unity won't be able to run everything fine in the editor (From splash to end Scene). All 16 scenes are included. It's even running fine in PC & Mac Build but for android it's just stops, Same as If I tapped the back key. :( :( \$\endgroup\$ – Adnan Nazir Apr 14 '14 at 13:59
  • 1
    \$\begingroup\$ OK, then you need to provide more information about how you're switching scenes, what kind of debugging you've done and so on. You'd help yourself a lot if you caught exceptions and wrote them to a log file. Right now, it's likely just failing horribly and ending the app. \$\endgroup\$ – MichaelHouse Apr 14 '14 at 14:05
  • \$\begingroup\$ Just as I mentioned that I am selecting scenes from my menu scene. When I click or tap on screen. Through RaycastHit I got the collider and after checking it's name I load my level with Application.LoadLevel(<Level Name - Whatever it is>); The main problem is that it works fine from editor, In PC & MAC Builds but for android it's getting touches but not loading \$\endgroup\$ – Adnan Nazir Apr 14 '14 at 14:12
  • \$\begingroup\$ Like I mentioned: Add exception handling and write out the log. Then you'll have all the information you need. \$\endgroup\$ – MichaelHouse Apr 14 '14 at 14:13
  • 1
    \$\begingroup\$ That's not a question to be addressed in the comments. Ask a new question. \$\endgroup\$ – MichaelHouse Apr 14 '14 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.