Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
Are your levels different scenes? –  Byte56 Apr 14 at 13:43
    
Yes they are different scenes ! –  gamenewdev Apr 14 at 13:44
    
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 –  Tetrad Apr 14 at 16:30

1 Answer 1

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.

share|improve this answer
    
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. :( :( –  gamenewdev Apr 14 at 13:59
1  
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. –  Byte56 Apr 14 at 14:05
    
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 –  gamenewdev Apr 14 at 14:12
    
Like I mentioned: Add exception handling and write out the log. Then you'll have all the information you need. –  Byte56 Apr 14 at 14:13
1  
That's not a question to be addressed in the comments. Ask a new question. –  Byte56 Apr 14 at 14:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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