codeAPI Reference

s&box InspectorEditorAttribute: Registering inspector editors

calendar_today May 12, 2026 schedule ~1 min read person PatrickJr verified 50

InspectorEditorAttribute API Reference

InspectorEditorAttribute is used to register a panel implementing IInspectorEditor with the inspector system.

Type Signature

CSHARP
namespace Sandbox;

[AttributeUsage(AttributeTargets.Class)]
public class InspectorEditorAttribute : Attribute
{
    public Type Type { get; }

    public InspectorEditorAttribute(Type type = null);
}

Properties

  • Type Type { get; } - The type this editor is for. If null, the editor is registered for the panel's own type.

Usage

Apply InspectorEditorAttribute to a panel class that implements IInspectorEditor to register it with the inspector:

CSHARP
[InspectorEditor]
public class MyComponentEditor : Panel, IInspectorEditor
{
    // Editor implementation
}

// Or specify the type explicitly
[InspectorEditor(typeof(MyComponent))]
public class MyComponentEditor : Panel, IInspectorEditor
{
    // Editor implementation
}

Notes

  • AttributeUsage is Class - can only be applied to classes
  • Used by the inspector system to discover and register custom editors
  • If Type is null, the editor is registered for the panel's own type
  • If Type is specified, the editor is registered for that type
  • The panel must implement IInspectorEditor to be used as an inspector editor
  • Commonly used for custom component editors in the sandbox
Was this helpful?