Version 3.3.0.1

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

Fields

AnimateVisibility
public bool AnimateVisibility

Properties

Attributes
Gets an immutable list of processed 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; }
Components
Gets an immutable list of the components attached to the property.
public ImmutableList<PropertyComponent> Components { 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; }
IsTreeRoot
public bool IsTreeRoot { 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; }
State
The PropertyState of the property at the current draw count index.
public PropertyState State { get; }
StateUpdaters
Gets an array of the state updaters of the property. Don't change the contents of this array!
public StateUpdater[] StateUpdaters { 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

CleanForCachedReuse()
public void CleanForCachedReuse()
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

GetComponent<T>()
Gets the component of a given type on the property, or null if the property does not have a component of the given type.
public T GetComponent<T>()
    where T : PropertyComponent
Returns
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

IsReachableFromRoot()
public bool IsReachableFromRoot()
Returns
System.Boolean

MarkSerializationRootDirty()
Marks the property's serialization root values dirty if they are derived from UnityEngine.Object.
public void MarkSerializationRootDirty()
NextProperty(Boolean, Boolean)
Gets the next property in the PropertyTree, or null if none is found.
public InspectorProperty NextProperty(bool includeChildren = true, bool visibleOnly = false)
Parameters
System.Boolean includeChildren

Whether to include children or not.

System.Boolean visibleOnly

Whether to only include visible properties.

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()
RecordForUndo(String, Boolean)
Records the property's serialization root for undo to prepare for undoable changes, with a custom string that includes the property path and Unity object name. If a message is specified, it is included in the custom undo string.
public void RecordForUndo(string message = null, bool forceCompleteObjectUndo = false)
Parameters
System.String message

System.Boolean forceCompleteObjectUndo

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.

TryGetTypedValueEntry<T>()
public IPropertyValueEntry<T> TryGetTypedValueEntry<T>()
Returns
Sirenix.OdinInspector.Editor.IPropertyValueEntry<T>

Type Parameters
T

Update(Boolean)
Updates the property. This method resets the temporary context, and updates the value entry and the property children.
public bool 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.

Returns
System.Boolean

Extension Methods