public virtual void PaintInspectorGUI(string title) { serializedObject.Update(); EditorGUILayout.BeginVertical(MalbersEditor.StyleBlue); EditorGUILayout.HelpBox(title, MessageType.None, true); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(MalbersEditor.StyleGray); { EditorGUI.BeginDisabledGroup(true); MonoScript script = MonoScript.FromScriptableObject(target as ScriptableObject); script = (MonoScript)EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false); EditorGUI.EndDisabledGroup(); //EditorGUILayout.BeginVertical(EditorStyles.helpBox); //EditorGUILayout.PropertyField(serializedObject.FindProperty("Clone"), new GUIContent("Set to Clone", "The current value")); //EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(serializedObject.FindProperty("value"), new GUIContent("Value", "The current value")); var useEvent = serializedObject.FindProperty("UseEvent"); useEvent.boolValue = GUILayout.Toggle(useEvent.boolValue, new GUIContent("E", "Enable 'OnValueChanged' Event. It will be invoked only when the value changes"), EditorStyles.miniButton, GUILayout.Width(18)); EditorGUILayout.EndHorizontal(); // MalbersEditor.DrawSplitter(); // EditorGUILayout.EndVertical(); // EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.PropertyField(serializedObject.FindProperty("Description")); // EditorGUILayout.EndVertical(); // EditorGUILayout.BeginVertical(EditorStyles.helpBox); //EditorGUILayout.PropertyField(useEvent, new GUIContent("Use Event", "If the value changes the On Value Changed Event will be invoked")); //EditorGUI.BeginDisabledGroup(!useEvent.boolValue); if (useEvent.boolValue) { MalbersEditor.DrawSplitter(); EditorGUILayout.PropertyField(serializedObject.FindProperty("OnValueChanged")); } // EditorGUILayout.EndVertical(); // EditorGUI.EndDisabledGroup(); EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }
public virtual void PaintInspectorGUI(string title) { serializedObject.Update(); EditorGUILayout.BeginVertical(MalbersEditor.StyleBlue); EditorGUILayout.HelpBox(title, MessageType.None, true); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(MalbersEditor.StyleGray); { EditorGUI.BeginDisabledGroup(true); MonoScript script = MonoScript.FromScriptableObject(target as ScriptableObject); script = (MonoScript)EditorGUILayout.ObjectField("Script", script, typeof(MonoScript), false); EditorGUI.EndDisabledGroup(); //EditorGUILayout.BeginVertical(EditorStyles.helpBox); //EditorGUILayout.PropertyField(serializedObject.FindProperty("Clone"), new GUIContent("Set to Clone", "The current value")); //EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); // EditorGUILayout.BeginVertical(EditorStyles.helpBox); // DrawDefaultInspector(); EditorGUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 55; EditorGUILayout.PropertyField(serializedObject.FindProperty("value"), new GUIContent("Value", "The current value")); EditorGUILayout.PropertyField(serializedObject.FindProperty("defaultValue"), new GUIContent("Default", "The value to return when Reset is called")); EditorGUIUtility.labelWidth = 0; EditorGUILayout.EndHorizontal(); MalbersEditor.DrawSplitter(); // EditorGUILayout.EndVertical(); // EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.PropertyField(serializedObject.FindProperty("Description")); // EditorGUILayout.EndVertical(); MalbersEditor.DrawSplitter(); // EditorGUILayout.BeginVertical(EditorStyles.helpBox); var useEvent = serializedObject.FindProperty("UseEvent"); useEvent.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Enable Event", "If Value changes, the Event 'OnValueChanged' will be invoked"), useEvent.boolValue); //EditorGUILayout.PropertyField(useEvent, new GUIContent("Use Event", "If the value changes the On Value Changed Event will be invoked")); EditorGUI.BeginDisabledGroup(!useEvent.boolValue); //if (useEvent.boolValue) { EditorGUILayout.PropertyField(serializedObject.FindProperty("OnValueChanged")); } // EditorGUILayout.EndVertical(); EditorGUI.EndDisabledGroup(); EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }