- Home /
Cant change scene on device.
Hello! I newbe in Unity and for learning the engine I want to create a simple game. But I have some trouble with changing scenes on device (in Editor it's work fine). There's my change scene code:
public Object PlayScene;
public Object AboutScene;
public Object HighscoresScene;
public void StartPlay()
{
SceneManager.LoadScene(PlayScene.name);
}
public void StartAbout()
{
SceneManager.LoadScene(AboutScene.name);
}
public void StartHighscore()
{
SceneManager.LoadScene(HighscoresScene.name);
}
public void ExitGame()
{
Application.Quit();
}
And yes I added scenes to project (I hope I added them right)
Answer by Blue-Cut · Apr 23, 2016 at 11:07 AM
Hmm, your problem sounds like a build settings problem. All the scenes you need to load are supposed to appear in your build settings. What I don't understand in your case is why it's working in editor mode oO, I am maybe missing something.
Anyway, the first thing to do is to open your other scenes and do "Add Open Scenes" in your build settings to have all the scenes you need to load appear in the list.
Let me know if it's enough to make it work.
Sorry for late answer. I tried, but it dosen't help. Something intresting I found. If replace this public void StartPlay() { Scene$$anonymous$$anager.LoadScene(PlayScene.name); } to this public void StartPlay() { Scene$$anonymous$$anager.LoadScene(1); } It works fine. P.S.: I can keep this code, but I want make it more flexible.