/// <summary> /// Update PlayerPrefs with values that should be saved. /// </summary> /// Note: This does not call PreferencesFactory.Save() /// <param name="prefix"></param> /// <param name="useSecurePrefs"></param> public void UpdatePlayerPrefs(string prefix = "", bool?useSecurePrefs = null) { foreach (var variable in BoolVariables) { if (variable.PersistChanges) { PreferencesFactory.SetBool(prefix + variable.Tag, variable.Value, useSecurePrefs); } } foreach (var variable in FloatVariables) { if (variable.PersistChanges) { PreferencesFactory.SetFloat(prefix + variable.Tag, variable.Value, useSecurePrefs); } } foreach (var variable in IntVariables) { if (variable.PersistChanges) { PreferencesFactory.SetInt(prefix + variable.Tag, variable.Value, useSecurePrefs); } } foreach (var variable in StringVariables) { if (variable.PersistChanges) { PreferencesFactory.SetString(prefix + variable.Tag, variable.Value, useSecurePrefs); } } foreach (var variable in Vector2Variables) { if (variable.PersistChanges) { PreferencesFactory.SetVector2(prefix + variable.Tag, variable.Value, useSecurePrefs); } } foreach (var variable in Vector3Variables) { if (variable.PersistChanges) { PreferencesFactory.SetVector3(prefix + variable.Tag, variable.Value, useSecurePrefs); } } foreach (var variable in ColorVariables) { if (variable.PersistChanges) { PreferencesFactory.SetColor(prefix + variable.Tag, variable.Value, useSecurePrefs); } } }