static void SetEditorPref <T>(string key, T value) { var k = GetEditorPrefKey <T>(key); if (typeof(T) == typeof(string)) { EditorPrefs.SetString(k, (string)(object)value); } else if (typeof(T) == typeof(bool)) { EditorPrefs.SetBool(k, (bool)(object)value); } else if (typeof(T) == typeof(float)) { EditorPrefs.SetFloat(k, (float)(object)value); } else if (typeof(T) == typeof(int)) { EditorPrefs.SetInt(k, (int)(object)value); } else { EditorPrefs.SetString(k, ValueWrapper <T> .Serialize(value)); } }