Version 2.1.0.0

InspectorProperty class

Namespace: Sirenix.OdinInspector.Editor
Assembly: Sirenix.OdinInspector.Editor
public sealed class InspectorProperty : IDisposable
Represents a property in the inspector, and provides the hub for all functionality related to that property.
Inheritance
  • System.Object
  • InspectorProperty

Properties

Attributes
Gets an immutable list of processes attributes for the property.
public ImmutableList<Attribute> Attributes { get; }
BaseValueEntry
The value entry that represents the base value of this property.
public PropertyValueEntry BaseValueEntry { get; }
Children
The children of this property.
public PropertyChildren Children { get; }
ChildResolver
Gets the resolver for this property's children.
public OdinPropertyResolver ChildResolver { get; }
Context
The context container of this property.
public PropertyContextContainer Context { get; }
DrawCount
The amount of times that the property has been drawn so far this frame.
public int DrawCount { get; }
DrawerChainIndex
How deep in the drawer chain the property currently is, in the current drawing session as determined by DrawCount.
public int DrawerChainIndex { get; }
Index
The child index of this property.
public int Index { get; }
Info
The InspectorPropertyInfo of this property.
public InspectorPropertyInfo Info { get; }
Label
The cached label of the property, usually containing NiceName.
public GUIContent Label { get; set; }
LastDrawnValueRect
The last rect that this property was drawn within.
public Rect LastDrawnValueRect { get; }
Name
The name of the property.
public string Name { get; }
NiceName
The nice name of the property, usually as converted by UnityEditor.ObjectNames.NicifyVariableName(System.String).
public string NiceName { get; }
Parent
The parent of the property. If null, this property is a root-level property in the PropertyTree.
public InspectorProperty Parent { get; }
ParentType
The type on which this property is declared. This is the same as TypeOfOwner.
public Type ParentType { get; }
ParentValueProperty
public InspectorProperty ParentValueProperty { get; }
ParentValues
The parent values of this property, by selection index; this represents the values that 'own' this property, on which it is declared.
public ImmutableList ParentValues { get; }
Path
The full Odin path of the property. To get the Unity property path, see UnityPropertyPath.
public string Path { get; }
PrefabModificationPath

The full path of this property as used by prefab modifications and the deep reflection system, containing all the necessary information to find this property through reflection only.

public string PrefabModificationPath { get; }
RecursiveDrawDepth

The current recursive draw depth, incremented for each time that the property has caused itself to be drawn recursively.

Note that this is the current recursion level, not the total amount of recursions so far this frame.

public int RecursiveDrawDepth { get; }
SerializationRoot
Gets the property which is the ultimate root of this property's serialization.
public InspectorProperty SerializationRoot { get; }
SupportsPrefabModifications
Whether this property supports having prefab modifications applied or not.
public bool SupportsPrefabModifications { get; }
Tree
The PropertyTree that this property exists in.
public PropertyTree Tree { get; }
UnityPropertyPath

The full Unity property path of this property; note that this is merely a converted version of Path, and not necessarily a path to an actual Unity property.

In the case of Odin-serialized data, for example, no Unity properties will exist at this path.

public string UnityPropertyPath { get; }
ValueEntry
The value entry that represents the strongly typed value of the property; this is possibly an alias entry in case of polymorphism.
public IPropertyValueEntry ValueEntry { get; }

Methods

Dispose()
public void Dispose()
Draw()
Draws this property in the inspector.
public void Draw()
Draw(GUIContent)
Draws this property in the inspector with a given default label. This default label may be overridden by attributes on the drawn property.
public void Draw(GUIContent defaultLabel)
Parameters
UnityEngine.GUIContent defaultLabel

FindChild(Func<InspectorProperty, Boolean>, Boolean)
Finds the first child recursively, that matches a given predicate.
public InspectorProperty FindChild(Func<InspectorProperty, bool> predicate, bool includeSelf)
Parameters
System.Func<InspectorProperty, System.Boolean> predicate

System.Boolean includeSelf

FindParent(Func<InspectorProperty, Boolean>, Boolean)
Finds the first parent property that matches a given predicate.
public InspectorProperty FindParent(Func<InspectorProperty, bool> predicate, bool includeSelf)
Parameters
System.Func<InspectorProperty, System.Boolean> predicate

System.Boolean includeSelf

GetActiveDrawerChain()
public BakedDrawerChain GetActiveDrawerChain()
GetAttribute<T>()
Gets the first attribute of a given type on this property.
public T GetAttribute<T>()
    where T : Attribute
Returns
T

Type Parameters
T

GetAttribute<T>(HashSet<Attribute>)
Gets the first attribute of a given type on this property, which is not contained in a given hashset.
public T GetAttribute<T>(HashSet<Attribute> exclude)
    where T : Attribute
Parameters
System.Collections.Generic.HashSet<System.Attribute> exclude

The attributes to exclude.

Returns
T

Type Parameters
T

GetAttributes<T>()
Gets all attributes of a given type on the property.
public IEnumerable<T> GetAttributes<T>()
    where T : Attribute
Returns
System.Collections.Generic.IEnumerable<T>

Type Parameters
T

IncrementDrawerChainIndex()
Increments the current drawer chain index. This is used by DrawerChainIndex.
public void IncrementDrawerChainIndex()
IsChildOf(InspectorProperty)
Determines whether this property is the child of another property in the hierarchy.
public bool IsChildOf(InspectorProperty other)
Parameters
InspectorProperty other

The property to check whether this property is the child of.

Returns
System.Boolean

Exceptions
System.ArgumentNullException

other is null

IsParentOf(InspectorProperty)
Determines whether this property is a parent of another property in the hierarchy.
public bool IsParentOf(InspectorProperty other)
Parameters
InspectorProperty other

The property to check whether this property is the parent of.

Returns
System.Boolean

Exceptions
System.ArgumentNullException

other is null

NextProperty(Boolean)
Gets the next property in the PropertyTree, or null if none is found.
public InspectorProperty NextProperty(bool includeChildren)
Parameters
System.Boolean includeChildren

Whether to include children or not.

PopDraw()
Pop a draw session. This is used by DrawCount and RecursiveDrawDepth.
public void PopDraw()
PopulateGenericMenu(GenericMenu)
Populates a generic menu with items from all drawers for this property that implement Sirenix.OdinInspector.Editor.IDefinesGenericMenuItems.
public void PopulateGenericMenu(GenericMenu genericMenu)
Parameters
UnityEditor.GenericMenu genericMenu

PushDraw()
Push a draw session. This is used by DrawCount and RecursiveDrawDepth.
public void PushDraw()
RefreshSetup()
public void RefreshSetup()
ToString()
Returns a System.String that represents this instance.
public override string ToString()
Returns
System.String

A System.String that represents this instance.

Update(Boolean)
Updates the property. This method resets the temporary context, and updates the value entry and the property children.
public void Update(bool forceUpdate = false)
Parameters
System.Boolean forceUpdate

If true, the property will update regardless of whether it has already updated for the current UpdateID.

This website is brand new and built with the Odin 2.1 beta in mind. This means you might discover some features such as attribute expressions that are only available in the beta.

You can download the 2.1 beta from here and read the patch-notes here.