If i got 4 levels what changes should i make in code

if i got 4 levels what changes should i make in code.i created 4 levels but after build and run my 2 levels are only running can someone tell me the code changes pls

As you posted this nearly two weeks ago I assume you’ve probably moved on from it through the other lectures! But just in case anyone comes along wondering the same, here’s how you can load the next level in line:

SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);

The number we’ve been manually entered is replaced by the code in brackets. “GetActiveScene” returns the currently active scene and “buildIndex” returns the number of said scene, then we increase it by 1.

1 Like

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

Privacy & Terms