Only had a quick look, still slightly hypnotised by the animated example…
Is your LevelManager on the Start scene? Assuming so…
LevelManager Start() method is called, that then calls the LoadStartScene() method, it ignores your AutoLoadNextLevel parameter as you don’t use it in the method, instead calling scene index 1, which is the Start scene…
…insert infinite loop here…
That’s what it looks like at a glance anyway…
Updated Thu Jan 26 2017 21:07
Sorry, just re-read and spotted the Invoke… so yes, it is using the value, just delaying the calling of the method which then loads the same scene etc…
so if i put 0 in the autoloadnextlevel there will not time to get load the scene and it will execute the scene again and again?
because if i put 2 or 1 or 10 there isn’t the error, only with the 0 but i think when will load the game scene will be returned to the start scene so… what i have to do?
its because the levelManager Script (Instance) is starting at the Start Scene
so I solved it like this:
I made a static bool variable called hasStarted = true;
and made an if statement at the Start() method :
if (hasStarted)
{
Invoke(“LoadNextLevel”, autoLoadNextLevel);
hasStarted = false;
}