Version 2.1.0.0

PropertyValueEntry class

Namespace: Sirenix.OdinInspector.Editor
Assembly: Sirenix.OdinInspector.Editor
public abstract class PropertyValueEntry : IPropertyValueEntry, IDisposable
Represents the values of an InspectorProperty, and contains utilities for querying the values' type and getting and setting them.
Inheritance
  • System.Object
  • PropertyValueEntry
See Also
  • Sirenix.OdinInspector.Editor.IPropertyValueEntry

Constructors

PropertyValueEntry()
protected PropertyValueEntry()

Properties

BaseValueType
The base type of the value entry. If this is value entry represents a member value, this is the type of the member. If the value entry represents a collection element, this is the element type of the collection.
public Type BaseValueType { get; }
Context
The context container of this property.
public PropertyContextContainer Context { get; }
DictionaryChangedFromPrefab
Whether this value entry has had its dictionary values changes from its prefab counterpart.
public bool DictionaryChangedFromPrefab { get; }
IsAlias
Whether this value entry is an alias, or not. Value entry aliases are used to provide strongly typed value entries in the case of polymorphism.
public bool IsAlias { get; }
IsBoxedValueType
Whether this value entry represents a boxed value type.
protected bool IsBoxedValueType { get; }
IsEditable
Whether this value entry is editable or not.
public bool IsEditable { get; }
IsMarkedAtomic
Whether this type is marked as an atomic type using a Sirenix.OdinInspector.Editor.IAtomHandler.
public abstract bool IsMarkedAtomic { get; }
ListLengthChangedFromPrefab
Whether this value entry has had its list length changed from its prefab counterpart.
public bool ListLengthChangedFromPrefab { get; }
ParentType
The type from which this value entry comes. If this value entry represents a member value, this is the declaring type of the member. If the value entry represents a collection element, this is the type of the collection.
public abstract Type ParentType { get; }
ParentValueProperty

The nearest parent property that has a value. That is, the property from which this value entry will fetch its parentvalues from in order to extract its own values.

If ParentValueProperty is null, this is a root property.

protected InspectorProperty ParentValueProperty { get; }
Property
The property whose values this value entry represents.
public InspectorProperty Property { get; }
SerializationBackend

The actual serialization backend for this value entry, possibly inherited from the serialization backend of the root property this entry is a child of.

Note that this is *not* always equal to SerializationBackend.

public SerializationBackend SerializationBackend { get; }
TargetReferencePath
If this value entry has the override type Reference, this is the path of the property it references.
public string TargetReferencePath { get; }
TypeOfValue
The most precise known contained type of the value entry. If polymorphism is in effect, this will be some type derived from BaseValueType.
public Type TypeOfValue { get; }
ValueChangedFromPrefab
Whether this value entry has been changed from its prefab counterpart.
public bool ValueChangedFromPrefab { get; }
ValueCount
The number of parallel values this entry represents. This will always be exactly equal to the count of WeakTargets.
public int ValueCount { get; }
ValueState
The special state of the value entry.
public PropertyValueState ValueState { get; }
WeakSmartValue

A weakly typed smart value that represents the first element of the value entry's value collection, but has "smart logic" for setting the value that detects relevant changes and applies them in parallel.

This lets you often just use the smart value instead of having to deal with the tedium of multiple parallel values.

public abstract object WeakSmartValue { get; set; }
WeakValues
Provides access to the weakly typed values of this value entry.
public abstract IPropertyValueCollection WeakValues { get; }

Methods

ApplyChanges()
Applies the changes made to this value entry to the target objects, and registers prefab modifications as necessary.
public abstract bool ApplyChanges()
Returns
System.Boolean

True if any changes were made, otherwise, false.

CreateAlias(PropertyValueEntry, Type)
Creates an alias value entry of a given type, for a given value entry. This is used to implement polymorphism in Odin.
public static IPropertyValueEntry CreateAlias(PropertyValueEntry entry, Type valueType)
Parameters
PropertyValueEntry entry

System.Type valueType

Returns
Sirenix.OdinInspector.Editor.IPropertyValueEntry

Dispose()
public void Dispose()
GetMostPreciseContainedType()
Determines what the most precise contained type is on this value entry.
protected abstract Type GetMostPreciseContainedType()
Returns
System.Type

GetValueState()
Determines the value state of this value entry.
protected abstract PropertyValueState GetValueState()
Initialize()
Initializes this value entry.
protected abstract void Initialize()
Update()
Updates the values contained in this value entry to the actual values in the target objects, and updates its state (override, type of value, etc.) accordingly.
public void Update()
UpdateValues()
Updates all values in this value entry from the target tree values.
protected abstract void UpdateValues()
ValueIsPrefabDifferent(Object, Int32)

Determines whether the value at the given selection index is different from the given prefab value, as is relevant for prefab modification checks.

If the value is a reference type, null and type difference is checked. If value is a value type, a comparer from GetEqualityComparerDelegate<T>() is used.

This method is best ignored unless you know what you are doing.

public abstract bool ValueIsPrefabDifferent(object value, int index)
Parameters
System.Object value

The value to check differences against.

System.Int32 index

The selection index to compare against.

Returns
System.Boolean

ValueTypeValuesAreEqual(IPropertyValueEntry)

Checks whether the values in this value entry are equal to the values in another value entry.

Note, both value entries must have the same value type, and must represent values that are .NET value types.

public abstract bool ValueTypeValuesAreEqual(IPropertyValueEntry other)
Parameters
Sirenix.OdinInspector.Editor.IPropertyValueEntry other

Returns
System.Boolean

Events

OnChildValueChanged
An event that is invoked during ApplyChanges(), when any child values have changed.
public event Action<int> OnChildValueChanged
OnValueChanged
An event that is invoked during ApplyChanges(), when any values have changed.
public event Action<int> OnValueChanged
Derived Classes

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.