Search Unity

Save and quit button

Discussion in 'Scripting' started by Divis10nStudios, Feb 12, 2018.

  1. Divis10nStudios

    Divis10nStudios

    Joined:
    Dec 26, 2017
    Posts:
    195
    I'm making a fairly simple game but it's pretty long so I want to add a save and quit button which loads the last scene the player was in before he quit the game.
    I'm fairly new but know the basics so could someone please tell me what to do please.
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    If all you care about is reloading the same scene, you could use PlayerPrefs. It's simple. Sure, it could be erased, but it's easy to start with.

    If you need to store more data, you can consider using Json (in Unity, JSonUtility), or BinaryFormatter.

    Here are some links for what was mentioned and a few other saving features:

    https://unity3d.com/learn/tutorials/topics/scripting/persistence-saving-and-loading-data

    https://docs.microsoft.com/en-us/dotnet/standard/serialization/basic-serialization

    https://docs.unity3d.com/ScriptReference/JsonUtility.html
     
  3. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
  4. Divis10nStudios

    Divis10nStudios

    Joined:
    Dec 26, 2017
    Posts:
    195