PropertyTree<T>

Represents a set of strongly typed values 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 sealed class PropertyTree<T> : PropertyTree
}

Requirements

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

Constructors

Definition Description
PropertyTree() Initializes a new instance of the PropertyTree<T> class, inspecting only the target ( !:T) type's static members.
PropertyTree(SerializedObject) Initializes a new instance of the PropertyTree<T> class.
PropertyTree(T[]) Initializes a new instance of the PropertyTree<T> class.
PropertyTree(T[], SerializedObject) Initializes a new instance of the PropertyTree<T> class.

Properties

Return Type Definition Description
bool IncludesSpeciallySerializedMembers Whether this property tree also represents members that are specially serialized by Odin.
PrefabModificationHandler PrefabModificationHandler Gets the prefabModificationHandler for the PropertyTree.
int RootPropertyCount The number of root properties in the tree.
InspectorProperty SecretRootProperty Gets the secret root property of the PropertyTree.
ImmutableList<T> Targets The strongly types actual values that the property tree represents.
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 weakly types 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.
IEnumerable<InspectorProperty> EnumerateTree(bool) Enumerates over the properties of the tree. WARNING: For tree that have large targets with lots of data, this may involve massive amounts of work as the full tree structure is resolved. USE THIS METHOD SPARINGLY AND ONLY WHEN ABSOLUTELY NECESSARY!
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) Finds the property at the specified modification path.
InspectorProperty GetPropertyAtUnityPath(string) Finds the property at the specified 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, 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).
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.