ParagonEditor
Abstract base class for Paragon custom editors. Wraps Odin Inspector's OdinEditor with UI Toolkit support, UXML template auto-loading, element querying helpers, and property tree disposal. Provides both a non-generic base and a generic ParagonEditor<T> variant with typed target access.
Definition
Namespace: Paragon.Editor Assembly: Paragon.Editor.dll
public abstract class ParagonEditor : OdinEditor, IDisposableInheritance: OdinEditor → ParagonEditor Implements: IDisposable
Generic Variant
public abstract class ParagonEditor<T> : ParagonEditor where T : UnityEngine.ObjectInheritance: OdinEditor → ParagonEditor → ParagonEditor<T>
Remarks
CreateInspectorGUI() is sealed — subclasses cannot override it. Instead, the editor lifecycle routes through:
CreateInspectorGUI()(sealed) — Clones the UXML template (ifvisualTreeAssetis assigned), creates the root element, adds anIMGUIContainerforOnInspectorGUI(), callsOnCreateGUI(), then schedulesInitialize()viaEditorApplication.delayCall.OnCreateGUI()— Override to set up UI elements after the template is cloned.Initialize()— Override for deferred setup that runs one frame afterOnCreateGUI().OnInspectorGUI()— Override for per-frame IMGUI drawing inside the embeddedIMGUIContainer.
Quick Lookup
Create a custom editor
Subclass ParagonEditor<T>, add [CustomEditor(typeof(MyType))]
Assign a UXML template
Set visualTreeAsset in the inspector or via [UxmlTemplate]
Query template elements
Q("elementName") or Q<Button>("elementName")
Access the inspected object
target (typed in generic variant)
Add IMGUI content
Override OnInspectorGUI()
Set up UI after template load
Override OnCreateGUI()
Deferred initialization
Override Initialize()
Fields
visualTreeAsset
VisualTreeAsset
protected
UXML template to clone. Assigned via Inspector. If null, an empty root element is created
rootVisualElement
VisualElement
protected
Root element containing template children and the IMGUI container
Methods
CreateInspectorGUI
Sealed. Creates the inspector UI by cloning the UXML template, adding the IMGUI container, and scheduling initialization.
OnCreateGUI
Virtual callback invoked after the UXML template is cloned and the root element is ready. Override to query template elements and build additional UI.
Initialize
Virtual callback invoked one frame after OnCreateGUI() via EditorApplication.delayCall. Override for setup that requires the visual tree to be fully attached.
OnInspectorGUI
Virtual callback for per-frame IMGUI rendering inside the embedded IMGUIContainer. Defaults to empty (no IMGUI content).
Q
Queries the rootVisualElement for a child element by name.
Dispose
Explicitly disposes the Odin property Tree. Called automatically via IDisposable.
Extension Points
Optional Overrides
OnCreateGUI()
Build UI after template cloning — query elements, wire callbacks
Initialize()
Deferred setup one frame after OnCreateGUI()
OnInspectorGUI()
Per-frame IMGUI content inside the embedded container
Implementation Requirements
When subclassing, you MUST:
Add
[CustomEditor(typeof(YourType))]to register with UnityUse the generic
ParagonEditor<T>variant for typed target access
You SHOULD:
Override
OnCreateGUI()to query UXML elements withQ()Use
Initialize()for setup that depends on the visual tree being attachedOverride
OnInspectorGUI()only if IMGUI fallback content is needed
You MUST NOT:
Override
CreateInspectorGUI()— it is sealedAccess template elements before
OnCreateGUI()is called
Properties (Generic Variant)
target
T
protected
Typed access to the inspected UnityEngine.Object (shadows Editor.target)
Common Pitfalls
Initialize() runs one frame late. It is scheduled via EditorApplication.delayCall, so any setup that depends on Initialize() will not be available in OnCreateGUI(). Query elements in OnCreateGUI(), perform deferred logic in Initialize().
OnInspectorGUI() defaults to empty. Unlike OdinEditor which draws the default property tree, ParagonEditor overrides OnInspectorGUI() with an empty body. If you want Odin's default inspector, call base.OnInspectorGUI() explicitly or draw properties manually.
Examples
Custom Editor with UXML Template
Custom Editor with IMGUI Fallback
See Also
ParagonDrawer<TProperty> — base class for property drawers
ParagonVisualElement — base class for reusable visual elements
ParagonVisualElementDrawer<TProperty> — UI Toolkit property drawers
Objects — editor objects overview
Last updated