Search Unity

Automatic saves

Discussion in 'Editor & General Support' started by kilix19980, Jul 16, 2017.

  1. kilix19980

    kilix19980

    Joined:
    Jun 13, 2015
    Posts:
    74
    Hello dear community is there a tutorial on auto saving ints like player exp , options , audio nd stuff i looked it up in youtube and there was a couple but only whit buttons save and load or in russian languade so how can i make it automatly save after round ? Can someone drop in a tutorial ?
     
  2. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    Dunno about any tutorials, but what you need is PlayerPrefs. You choose what to save with PlayerPrefs.SetInt, SetFloat, or SetString, and retrieve it with PlayerPrefs.GetInt, GetFloat, GetString. Once you’ve chosen everything you want to save, call PlayerPrefs.Save. Note that Save is automatically called on Application shutdown, and when it is called your game will briefly halt as data is written to disk.