Loop back to start fail?

As far as I can see I have written my code exactly as Ben has done. The level progression works fine but the game doesn’t loop back to the start after the last level.Capture

1 Like

same here.

Hi,

Scene.sceneCountInBuildSettings returns the number of scenes in the BuildSettings. However, since the first scene has got index 0, the last scene must be Scene.sceneCountInBuildSettings - 1.

Alternatively, the condition could say (nextSceneIndex == SceneManager.sceneCountInBuildSettings).

nextSceneIndex = 0; gets executed only if the if condition was evaluated to true. To narrow down the problem, it’s always a good idea to log a message into one’s console to see if a code block gets executed.


See also:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms