private void OnApplicationFocus(bool focus) { if (focus && initialized) { PersistantSave.LoadFromPersistant(); } else { PersistantSave.SaveToPersistant(); } }
private void OnApplicationPause(bool pause) { if (pause) { PersistantSave.SaveToPersistant(); } else if (initialized) { PersistantSave.LoadFromPersistant(); } }
public void Init() { if (initialized) { return; } if (_objectsToPersist == null || _objectsToPersist.Count == 0) { if (intTryCounter > 100) { Debug.LogError("[PS] Init failed"); return; } Invoke(nameof(Init), 0f); intTryCounter++; return; } initialized = true; PersistantSave.Init(_hashSalt, _encryptKey, _inPersistantPath, _objectsToPersist); PersistantSave.LoadFromPersistant(); }