public static void DrawSettings(LogSettingsSO settings) { if (_drawer == null) { _drawer = new LogLevelsGUI(settings); } Debug.Assert(_drawer.settings == settings); _drawer.Draw(); }
public static LogSettingsSO DrawCreateNewButton() { if (GUILayout.Button("Create New Settings")) { LogSettingsSO newSettings = ScriptableObjectUtility.CreateAsset <LogSettingsSO>(nameof(LogSettingsSO), "Assets"); newSettings.SaveFromLogFactory(); return(newSettings); } return(null); }
public override void OnGUI(string searchContext) { // look for existing settings first if (settings == null) { settings = EditorLogSettingsLoader.FindLogSettings(); } // then draw field settings = (LogSettingsSO)EditorGUILayout.ObjectField("Settings", settings, typeof(LogSettingsSO), false); // then draw rest of ui if (settings == null) { settings = LogLevelsGUI.DrawCreateNewButton(); } else { LogLevelsGUI.DrawSettings(settings); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); var target = this.target as LogSettings; if (target.settings == null) { LogSettingsSO newSettings = LogLevelsGUI.DrawCreateNewButton(); if (newSettings != null) { SerializedProperty settingsProp = serializedObject.FindProperty("settings"); settingsProp.objectReferenceValue = newSettings; serializedObject.ApplyModifiedProperties(); } } else { LogLevelsGUI.DrawSettings(target.settings); } }
public LogSettingChecker(LogSettingsSO settings) { this.settings = settings; }
public LogLevelsGUI(LogSettingsSO settings) { this.settings = settings; checker = new LogSettingChecker(settings); }