Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            var target = this.target as LogSettings;

            if (target._settings == null)
            {
                var newSettings = LogLevelsGUI.DrawCreateNewButton();
                if (newSettings != null)
                {
                    var settingsProp = serializedObject.FindProperty("settings");
                    settingsProp.objectReferenceValue = newSettings;
                    serializedObject.ApplyModifiedProperties();
                }
            }
            else
            {
                LogLevelsGUI.DrawSettings(target._settings);
            }
        }