PropertyTree

Represents a set of values of the same type as a tree of properties that can be drawn in the inspector, and provides an array of utilities for querying the tree of properties.

This class also handles management of prefab modifications.

namespace Sirenix.OdinInspector.Editor
{
public abstract class PropertyTree
}

Requirements

Namespace: Sirenix.OdinInspector.Editor
Assembly: Sirenix.OdinInspector
Version: 2.0.0.0

Static Methods

Return Type Definition Description
PropertyTree Create(IList)

Creates a new PropertyTree for a set of given target values.

Note that the targets all need to be of the same type.

PropertyTree Create(IList, SerializedObject)

Creates a new PropertyTree for a set of given target values, represented by a given SerializedObject.

Note that the targets all need to be of the same type.

PropertyTree Create(Object) Creates a new PropertyTree for a given target value.
PropertyTree Create(Object[])

Creates a new PropertyTree for a set of given target values.

Note that the targets all need to be of the same type.

PropertyTree Create(SerializedObject) Creates a new PropertyTree for all target values of a SerializedObject.
PropertyTree CreateStatic(Type) Creates a PropertyTree to inspect the static values of the given type.

Constructors

Definition Description
PropertyTree() Creates a new PropertyTree for all target values of a SerializedObject.

Events

Definition Description
OnPropertyValueChanged This event is invoked whenever the value of any property in the entire property tree is changed through the property system.
OnUndoRedoPerformed An event that is invoked whenever an undo or a redo is performed in the inspector. The advantage of using this event on a property tree instance instead of undoRedoPerformed is that this event will be desubscribed from undoRedoPerformed when the selection changes and the property tree is no longer being used, allowing the GC to collect the property tree.

Properties

Return Type Definition Description
OdinAttributeProcessorLocator AttributeProcessorLocator Gets or sets the OdinAttributeProcessorLocator for the PropertyTree.
DrawerChainResolver DrawerChainResolver Gets or sets the DrawerChainResolver for the PropertyTree.
bool DrawMonoScriptObjectField Gets a value indicating whether or not to draw the mono script object field at the top of the property tree.
bool IncludesSpeciallySerializedMembers Whether this property tree also represents members that are specially serialized by Odin.
bool IsStatic Gets a value indicating whether or not the PropertyTree is inspecting a static type.
PrefabModificationHandler PrefabModificationHandler The prefab modification handler of the tree.
OdinPropertyResolverLocator PropertyResolverLocator Gets or sets the OdinPropertyResolverLocator for the PropertyTree.
int RootPropertyCount The number of root properties in the tree.
InspectorProperty SecretRootProperty Gets the secret root property of the tree, which hosts the property resolver used to resolve the "actual" root properties of the tree.
Type TargetType The type of the values that the property tree represents.
SerializedObject UnitySerializedObject The SerializedObject that this tree represents, if the tree was created for a SerializedObject.
int UpdateID The current update ID of the tree. This is incremented once, each update, and is used by Update(bool) to avoid updating multiple times in the same update round.
ImmutableList<Object> WeakTargets The actual values that the property tree represents.

Methods

Return Type Definition Description
bool ApplyChanges() Applies all changes made with properties to the inspected target tree values.
void DelayAction(Action) Schedules a delegate to be invoked at the end of the current GUI frame.
void DelayActionUntilRepaint(Action) Schedules a delegate to be invoked at the end of the next Repaint GUI frame.
void Draw(bool)

Draw the property tree, and handles management of undo, as well as marking scenes and drawn assets dirty.

This is a shorthand for calling BeginDrawPropertyTree(PropertyTree, bool), DrawPropertiesInTree(PropertyTree) and . EndDrawPropertyTree(PropertyTree).

IEnumerable<InspectorProperty> EnumerateTree(bool) Enumerates over the properties of the tree.
void ForceRegisterObjectReference(Object, InspectorProperty) Registers an object reference to a given path; this is used to ensure that objects are always registered after having been encountered once.
InspectorProperty GetPropertyAtDeepReflectionPath(string) Gets the property at the given deep reflection path.
InspectorProperty GetPropertyAtPath(string) Gets the property at the given path. Note that this is the path found in Path, not the Unity path.
InspectorProperty GetPropertyAtPrefabModificationPath(string) Gets the property at the given Odin prefab modification path.
InspectorProperty GetPropertyAtUnityPath(string) Gets the property at the given Unity path.
int GetReferenceCount(Object) Gets the number of references to a given object instance in this tree.
InspectorProperty GetRootProperty(int) Gets the root tree property at a given index.
SerializedProperty GetUnityPropertyForPath(string) Gets a Unity property for the given Odin or Unity path. If there is no SerializedObject for this property tree, or no such property is found in the SerializedObject, a property will be emitted using UnityPropertyEmitter.
SerializedProperty GetUnityPropertyForPath(string, ref FieldInfo) Gets a Unity property for the given Odin or Unity path. If there is no SerializedObject for this property tree, or no such property is found in the SerializedObject, a property will be emitted using UnityPropertyEmitter.
void InvokeDelayedActions() Invokes the actions that have been delayed using DelayAction(Action) and DelayActionUntilRepaint(Action).
void InvokeOnValidate() Invokes the OnValidate method on the property tree's targets if they are derived from Object and have the method defined.
bool ObjectIsReferenced(Object, ref string) Checks whether a given object instance is referenced anywhere in the tree, and if it is, gives the path of the first time the object reference was encountered as an out parameter.
void RegisterPropertyDirty(InspectorProperty) Registers that a given property is dirty and needs its changes to be applied at the end of the current frame.
void ReplaceAllReferences(Object, Object) Replaces all occurrences of a value with another value, in the entire tree.
void UpdateTree() Updates all properties in the entire tree, and validates the prefab state of the tree, if applicable.