Editor<T> Class

Summary

[Pro-Only] [Editor-Only] Base class to derive custom editors from, with a bunch of additional features on top of Unity's base UnityEditor.Editor class.
graph BT Type-->Base0["MissingScriptEditor"] click Base0 "/inspector-gadgets/api/InspectorGadgets.Editor/MissingScriptEditor" Base0-->Base1["Editor"] Type["Editor<T>"] class Type type-node

Syntax

public abstract class Editor<T> : MissingScriptEditor where T : class

Remarks

Doesn't draw the target's "Script" field to save inspector space and reduce clutter.

You can Middle Click anywhere in the inspector area to open the script in your script editor or Ctrl + Middle Click to open its editor script (or create one if none exists already).

Provides type-casted versions of UnityEditor.Editor.target and UnityEditor.Editor.targets so you don't always have to do it yourself (InspectorGadgets.Editor.Editor`1.Target and InspectorGadgets.Editor.Editor`1.Targets respectively).

Type Parameters

Name Description
T

Properties

Name Value Summary
Current Editor<T>
The editor currently being drawn.
static
CurrentTarget T
The object being inspected (UnityEditor.Editor.target casted to T) by the editor currently being drawn.
static
CurrentTargets T[]
An array of all the objects being inspected (UnityEditor.Editor.targets casted to T) by the editor currently being drawn.
static
OtherProperties List<SerializedProperty>
All of the target's properties other than "m_Script".
Inherited from MissingScriptEditor
ScriptProperty SerializedProperty
The target's "m_Script" property.
Inherited from MissingScriptEditor
Target T
The object being inspected (UnityEditor.Editor.target casted to T).
Targets T[]
An array of all the objects being inspected (UnityEditor.Editor.targets casted to T).

Methods

Name Value Summary
CheckMiddleClick(Rect) void
Checks if the current event is a Middle Click to open the script in the user's script editor application, or Ctrl + Middle Click to open or create its custom inspector script.
DestroyProperly(Object, bool) void
Destroys the `target`. Shows a confirmation dialog before destroying assets.
Inherited from MissingScriptEditor
static
DestroyProperly(Object[], bool) void
Destroys the `targets`. Shows a confirmation dialog before destroying assets.
Inherited from MissingScriptEditor
static
DoAllInspectables() void
[Pro-Only] Draw all InspectorGadgets.Attributes.InspectableAttribute members.
DoInspectorGUI() void
Draws the inspector GUI of the InspectorGadgets.Editor.Editor`1.Current editor.
static
DoPropertiesAndInspectables() void
Draws all of the target's serialized properties and inspectables.
OnDisable() void
Indicates to the InspectorGadgets.Editor.MissingScriptWindow that the target has been deselected.
Inherited from MissingScriptEditor
OnEnable() void
Gathers all of the target's inspectables (InspectorGadgets.Attributes.ButtonAttribute and InspectorGadgets.Attributes.LabelAttribute) and checks for inspector GUI events in the script.
OnInspectorGUI() void
Draws the target's regular inspector followed by any extra inspectables (InspectorGadgets.Attributes.ButtonAttribute and InspectorGadgets.Attributes.LabelAttribute), and responds to Middle Click events.

To modify or replace just the regular inspector and keep the extra features of InspectorGadgets.Editor.Editor`1, override InspectorGadgets.Editor.Editor`1.DoPropertiesAndInspectables instead of InspectorGadgets.Editor.Editor`1.OnInspectorGUI.
OnPropertyModified() void
This method is called if any of the target's serialized members are modified during InspectorGadgets.Editor.Editor`1.DoInspectorGUI.
RecordTargetUndo(string) void
Records the current state of the InspectorGadgets.Editor.Editor`1.Targets so that any subsequent changes can be undone (reverted back to the recorded state).