Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to make a save and load button for scenes?

I have been looking all over the internet trying to understand PlayerPrefs and while I am starting to get it and how to start doing it I still don't know how to make a save button for the player so it saves the scene he is in and when he comes back to the game is able to press a load button and be able to load the scene he was in the last time he hit the save button without the scene being modified. Can someone explain or send me a link on how to do this?

Best Answer

  • Accepted Answer

    sceneID = SceneManager.GetActiveScene().buildIndex


    *.bulidindex* returns an integer.

Answers

  • Whenever you save you should you a playerpref lets call it sceneID

    sceneID = SceneManager.GetActiveScene().buildIndex;

    Now when you load you just use SceneManger.LoadScene(sceneID

  • I'm sorry but I'm still confused I thought that playerprefs would have to be saved by an int I just have to put those 2 lines of code into the script and it'll work??

  • Thank you.

Sign In or Register to comment.