[Solved]Issue with playerprefs

Updated on November 24, 2017 in [A] Unity Scripting
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
0 on November 24, 2017

So i watched 

How to make a HIGH SCORE in Unity

I want to save the current scene in playerprefs and continue from wherever the player quits.


I tried this code


void Start() { 
SceneManager.GetSceneAt( PlayerPrefs.GetInt(“SaveScene”,0) );


void OnApplicationQuit(){
PlayerPrefs.SetInt (“SaveScene”,SceneManager.GetActiveScene().buildIndex);


and i am getting this error


IndexOutOfRangeException: Scene index “1” is out of range.


I have 5 scenes in build.


please let me know what is wrong with code.if you have any better way please share it

  • Liked by