Namespace: | Sirenix.OdinInspector.Editor |
Assembly: | Sirenix.OdinInspector.Editor |
public abstract class OdinDrawer
Base class for all Odin drawers. In order to create your own custom drawers you need to derive from one of the following drawers:
Remember to provide your custom drawer with an Sirenix.OdinInspector.Editor.OdinDrawerAttribute in order for it to be located by the Sirenix.OdinInspector.Editor.DrawerLocator.
Drawers require a PropertyTree context, and are instantiated automatically by the Sirenix.OdinInspector.Editor.DrawerLocator.
Odin supports the use of GUILayout and takes care of undo for you. It also takes care of multi-selection in many simple cases. Checkout the manual for more information.
protected OdinDrawer()
protected bool AutoSetGUIEnabled { get; }
public bool Initialized { get; }
public InspectorProperty Property { get; }
true
then this drawer will be skipped in the draw chain. Otherwise the drawer will be called as normal in the draw chain.
public bool SkipWhenDrawing { get; set; }
protected bool CallNextDrawer(GUIContent label)
UnityEngine.GUIContent | label | The label to pass on to the next drawer. |
System.Boolean |
public virtual bool CanDrawProperty(InspectorProperty property)
InspectorProperty | property | The property to test. |
System.Boolean |
|
Override this method in order to define custom type constraints to specify whether or not a type should be drawn by the drawer.
Note that Odin's Sirenix.OdinInspector.Editor.DrawerLocator has full support for generic class constraints, so most often you can get away with not overriding CanDrawTypeFilter.
public virtual bool CanDrawTypeFilter(Type type)
System.Type | type | The type. |
System.Boolean | Returns true by default, unless overridden. |
public void DrawProperty(GUIContent label)
UnityEngine.GUIContent | label | The label. Null is allow if you wish no label should be drawn. |
protected virtual void DrawPropertyLayout(GUIContent label)
UnityEngine.GUIContent | label | The label. This can be null, so make sure your drawer supports that. |
protected virtual void Initialize()
public void Initialize(InspectorProperty property)
InspectorProperty | property |