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: 1.0.6.1

Constructors

Definition Description
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 HasPrefabs Whether any of the values the property tree represents are prefab instances.
bool IncludesSpeciallySerializedMembers Whether this property tree also represents members that are specially serialized by Odin.
PropertyTree PrefabPropertyTree A prefab tree for the prefabs of this property tree's prefab instances, if any exist.
int RootPropertyCount The number of root properties in the tree.
ImmutableList<Object> TargetPrefabs The prefabs for each prefab instance represented by the property tree, if any.
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
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.
List<PrefabModification> GetPrefabModifications(int) Gets all prefab modifications in this property tree for a given selection index.
Nullable<PrefabModificationType> GetPrefabModificationType(InspectorProperty) Gets the prefab modification type of a given property, if any. Note that this only works on Odin-serialized properties.
InspectorProperty GetPropertyAtDeepReflectionPath(string) Gets the property at the given deep reflection path. This is a dictionary look-up.
InspectorProperty GetPropertyAtPath(string) Gets the property at the given path. Note that this is the path found in Path, not the Unity path. This is a dictionary look-up.
InspectorProperty GetPropertyAtUnityPath(string) Gets the property at the given Unity path. This is a dictionary look-up.
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 RegisterPrefabDictionaryAddKeyModification(InspectorProperty, int, Object) Adds an add key modification to the dictionary modifications of a given property.
void RegisterPrefabDictionaryDeltaModification(InspectorProperty, int) Calculates a delta between the current dictionary property and its prefab counterpart, and registers that delta as a Dictionary modification.
void RegisterPrefabDictionaryRemoveKeyModification(InspectorProperty, int, Object) Adds a remove key modification to the dictionary modifications of a given property.
void RegisterPrefabListLengthModification(InspectorProperty, int, int) Registers a modification of type ListLength for a given property.
void RegisterPrefabValueModification(InspectorProperty, int, bool) Registers a modification of type Value for a given property.
void RemovePrefabDictionaryModification(InspectorProperty, int, Object) Removes all dictionary modifications on a property for a given dictionary key value.
void RemovePrefabModification(InspectorProperty, int, PrefabModificationType) Removes all prefab modifications of a given type on a given property.
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.