public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (RSDataStore == null) { RSDataStore = AssetDatabase.LoadAssetAtPath(string.Format(m_PathToDataStore, m_DataStoreName), typeof(RemoteSettingsHolder)) as RemoteSettingsHolder; } State state = RestoreState(property); OnGUI(position); state.lastSelectedIndex = m_LastSelectedIndex; }
private void CheckAndCreateDataStore() { string formattedPath = string.Format(m_PathToDataStore, m_DataStoreName); if (AssetDatabase.FindAssets(m_DataStoreName).Length == 0) { RemoteSettingsHolder asset = ScriptableObject.CreateInstance <RemoteSettingsHolder>(); asset.rsKeyList = new List <RemoteSettingsKeyValueType>(); CheckAndCreateAssetFolder(k_RemoteSettingsDataPath); AssetDatabase.CreateAsset(asset, formattedPath); AssetDatabase.SaveAssets(); RSDataStore = AssetDatabase.LoadAssetAtPath(formattedPath, typeof(RemoteSettingsHolder)) as RemoteSettingsHolder; } else { RSDataStore = AssetDatabase.LoadAssetAtPath(formattedPath, typeof(RemoteSettingsHolder)) as RemoteSettingsHolder; } }