Page 1 of 1

failed to save and load scene with build index (int)

Posted: Tue Apr 26, 2022 9:24 pm
by tori
hi i trier use ES3.save
and ES3.Load
I just want my game remember the current scene
so using build index I tried to save an Int "mycurrentLVL"
and load it in start like this

public void Start()
{
MyCurrentLvl = ES3.Load("myInt", defaultValue);
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + MyCurrentLvl);
}

and my game try to load the last scene each time (regardless of the number of scene ) and try to load one more scene that dont exist (if I have 6 it will load 6 and try load 7 )

I hope be helped :/

Re: failed to save and load scene with build index (int)

Posted: Wed Apr 27, 2022 8:27 am
by Joel
Hi there,

There is an error in your code unrelated to Easy Save.

You seem to be trying to append the loaded build index onto the current build index when you should only be providing the loaded build index as a parameter to the SceneManager.LoadScene method.

I also strongly recommend against using the scene index and use the scene name instead, as the scene index can change if you remove or move scenes in your build settings.

All the best,
Joel