Class CustomInspector<T>Abstract Public Self

The CustomInspector class enables developers to implement custom inspection behavior by subclassing the class and adding the CustomInspectorAttribute to the class. The attribute denotes which types the CustomInspector implementation supports.

To add an inspector to your UILayout simply create an instance of UIInspector. The UIInspector class will automatically manage the creation of internal and CustomInspector instances.

Type Parameters

  • T = any

Constructors

Properties

kStartBackgroundDepth: number

Accessors

  • get inspectedObject(): T
  • Returns the object the inspector is currently displaying. If the current object is a resource use inspectedResourcePath instead;

    Returns T

  • set inspectedObject(newObject): void
  • Parameters

    • newObject: T

    Returns void

Methods

  • Virtual

    Destroys all inspector UI elements.

    Returns void

  • Finishes recording an undo command started via startUndoForField. If any changes are detected on the object an undo command is recorded onto the undo-redo stack, otherwise nothing is done.

    Returns void

  • Changes keyboard focus to the provided field.

    Parameters

    • path: string

      Path to the field on the object being inspected.

    Returns void

  • Called when the inspector is first created. Loads the resource if required.

    Parameters

    Returns Resource

  • Initializes the inspector using an object instance. Must be called after construction.

    Parameters

    • parentLayout: UILayout

      UI panel to add the UI elements to.

    • instance: any

      Instance of the object whose fields to display UI for.

    • persistentProperties: SerializableProperties

      A set of properties that the inspector can read/write. They will be persisted even after the inspector is closed and restored when it is re-opened.

    • undoRedo: UndoRedo

      The UndoRedo stack to be used for this inspector. If null, UndoRedo will not be available.

    • Optionalwindow: EditorWindowBase

      The window that owns this inspector. Can be null.

    • OptionalisReadOnly: boolean

      Determines if the inspector is read-only.

    • OptionalparentInspectableProperty: InspectableProperty
    • Optionaldepth: number

    Returns void

  • Initializes the inspector using a resource path. Must be called after construction.

    Parameters

    • parentLayout: UILayout

      Primary UI panel to add the UI elements to.

    • resourcePath: LibraryIdentifierPath

      Path to the resource for which to display UI for.

    • persistentProperties: SerializableProperties

      A set of properties that the inspector can read/write. They will be persisted even after the inspector is closed and restored when it is re-opened.

    • undoRedo: UndoRedo

      The UndoRedo stack to be used for this inspector. If null, UndoRedo will not be available.

    • Optionalwindow: EditorWindowBase

      The window that owns this inspector. Can be null.

    Returns void

  • Notifies the inspector that it needs to be refreshed on the next update loop.

    Returns void

  • Notifies the inspector that it needs to be reinitialized on the next update loop.

    Returns void

    This API fully reinitializes the inspectors and recreates all fields. This can have a negative impact on the user experience. In most circumstances notifyNeedsRefresh should be called instead, to only update the field data.

  • Virtual

    Invoked when the inspector is being destroyed.

    Returns void

  • Virtual

    Invoked when the inspected fields have been modified. Use this callback to mark your resource as dirty if you implement a custom resource inspector.

    Returns void

  • Called when the inspector is first created and fields must be registered.

    Returns any

    Use the fields property to add fields for your custom inspector. To automatically register all fields for an object use InspectorFieldContainer.addDefault and pass your object to the function.

  • Virtual

    Checks if contents of the inspector have been modified, and updates them if needed.

    Parameters

    • OptionalisForced: boolean

      Forces the UI fields to display the latest values assigned on the object.

    Returns EnumValue<InspectableState, number>

    State representing was anything modified between two last calls to refresh.

  • Immediately reinitializes the inspector, clears all contents and rebuilds the fields.

    Returns void

    In most circumstances this API should not be called, instead use notifyNeedsRefresh to make the existing inspector fields refresh all their fields from the inspected object data.

    To ensure correct behavior for higher level systems call notifyNeedsReinitalize to reinitialize the next frame to allow events to propagate fully in the current frame.

  • Zero parameter wrapper for startUndoForField

    Returns void

  • Notifies the system to start recording a new undo command. Any changes to the field after this is called will be recorded in the command. User must call endUndo after field is done being changed.

    Parameters

    • field: string

      Name of the field being modified.

    Returns void