Pass to the next level problem

When ı play my game on computer there is no problem.But when ı build my game to phone several functions in the game stops working. One of these functions is go to the next level. Actually ı use common simple code line for this :

public void next()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}

I have already add my all scenes to build screen.As ı said before ,on computer I can go to next level succesfully.

It’s always going to be better to go to the next level explicitly, using the name of the level:

SceneManager.LoadScene( "MyLevel1");

If you must use this oldschool linear integer incrementing approach, you will have to put in some Debug.Log() statements and then watch the console log to see what the numbers are.

1 Like