Пример #1
0
 /// <summary>
 ///     Wipes <see cref="Instance" /> and deletes any existing save data within <see cref="PlayerPrefs" />.
 /// </summary>
 public static void Reset()
 {
     Instance = new PlayerData();
     PlayerPrefs.DeleteKey( typeof( PlayerData ).Name );
 }
Пример #2
0
 /// <summary>
 ///     Assigns any save data within <see cref="PlayerPrefs" /> to <see cref="Instance" />.
 /// </summary>
 /// <param name="defaultData">
 ///     Default data to load if no save exists.
 /// </param>
 public static void Load( PlayerData defaultData = null )
 {
     Instance = PlayerPrefsHelper.TryLoad( typeof( PlayerData ).Name,
                                           defaultData ?? new PlayerData() );
 }