-2
\$\begingroup\$

I made a game with two scenes and everytime I call the function SceneManager.LoadScene(), no matter the value, type(string or int) or mode(single or additive) of the parameters, the scene with build index 0 is always getting loaded.

Code

Build Settings

\$\endgroup\$
4
  • \$\begingroup\$ is the other scene added to the build menu? \$\endgroup\$ – Uri Popov Mar 4 '17 at 11:20
  • \$\begingroup\$ Yep it is, with build index number 1, and when I set this scene to build index 0, it gets loaded all the time. \$\endgroup\$ – Sherin Binu Mar 4 '17 at 11:54
  • \$\begingroup\$ A screenshot of build settings and part of the code where you call this function will help us identify the problem. So, please do include them. \$\endgroup\$ – Aditya Yadav Mar 4 '17 at 13:04
  • \$\begingroup\$ Ive added the screenshots, and in the code given, ive tried changing the modes and also tried with 1 and 2 as parameter, but its always the first scene that's getting loaded. \$\endgroup\$ – Sherin Binu Mar 4 '17 at 16:45
0
\$\begingroup\$

You're trying to load "Level 2" but the scene name in the build settings is Level2 (no space)

\$\endgroup\$
2
  • \$\begingroup\$ Well, it was just the typo mistake with my last try, But ive tried a lot of times with the correct spelling. But I ve solved the issue. The problem is restartTimer never gets greater then restartDelay and the if statement never gets executed. So ive decreased the restartDelay and it works just fine \$\endgroup\$ – Sherin Binu Mar 5 '17 at 7:21
  • \$\begingroup\$ You should write that as an answer then and accept it. \$\endgroup\$ – Tyyppi_77 Mar 5 '17 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.