- Home /
Application.Loadlevel("Level Name"); not working on android
Hello all. I'm making a simple android game. I need to change scene when the screen is touched. It works ok on the PC with a click, but it doesn't work on android. I have already seen some questions with the same problem but none of them had a working answer. The code I am using is:
if (Input.touchCount == 1){
Touch touch = Input.touches[0];
if(touch.phase==TouchPhase.Began){
Application.LoadLevel("Level Name");
}
}
Do you have any suggestions?
Answer by TrivialRoo · Aug 23, 2014 at 04:35 PM
Ah. I had this same problem. I think the solution that worked for me was when you build to Android you UNCHECK Split Application Binary. Google Play DOES still allow you to submit to the Play store without split application binaries so you're good there. I think it has something to do with the interaction between the two binaries when Unity builds.
Answer by Petrol · Aug 23, 2014 at 01:04 AM
I tried your code in my android project and it was working fine.
Are you sure you are not mispelling your "Level Name" ? The string is case sensitive so "level name" and "Level Name" (or whatever the real name is) are not equals.
Also be sure you added the level you want to load in your build settings : Load the scene in the editor then in Edit->Build Settings : click on "Add Current"
You can check this link :
http://docs.unity3d.com/ScriptReference/Application.LoadLevel.html
The level is added on build settings and its spelled correctly. It works great in The ediyor, but on android it doesnt work. Only Application.Quit(); works.
add some debug.logs or prints so you can see whether it's that the touch isn't working or if it's really the level loading not working
I don't think it's the touch that's the problem, because Application.Quit(); works. I think the problem is in the LoadLevel part
Your answer
Follow this Question
Related Questions
Application.LoadLevel Strange Problem 2 Answers
How to create a complicated game over scene ? Help 1 Answer
What API lvl to use? 0 Answers
How to load a level after 30 seconds? 3 Answers