Table of Contents

Class ValueBinding<T>

Namespace
Coherence.Toolkit.Bindings
Assembly
Coherence.Toolkit.dll

Base class used for all synced fields, properties and parameters.

public abstract class ValueBinding<T> : Binding

Type Parameters

T

The coherence value type used to serialize the field or property. The coherence value type may differ from the unity value type. For example, all integer types: uint, short, ushort, byte, char are backed by int as their coherence value type.

Inheritance
ValueBinding<T>
Derived
Inherited Members

Constructors

ValueBinding()

protected ValueBinding()

ValueBinding(Descriptor, Component)

public ValueBinding(Descriptor descriptor, Component unityComponent)

Parameters

descriptor Descriptor
unityComponent Component

Fields

valueSyncNew

protected T valueSyncNew

Field Value

T

valueSyncOld

protected T valueSyncOld

Field Value

T

valueSyncPrepared

protected bool valueSyncPrepared

Field Value

bool

Properties

Signature

Rich text representation of the binding's name and type that is displayed in the Configure and Optimize binding windows.

public override string Signature { get; }

Property Value

string

UntypedValue

The current Value expressed as an object. This is useful when the exact binding type is unknown (e.g., in unit tests) but should be avoided in hotpaths due to boxing.

public override object UntypedValue { get; }

Property Value

object

Value

The current value of the target field/property on the binding's Unity component. This is generally the value you'll see in the inspector.

public virtual T Value { get; set; }

Property Value

T

Methods

ClampToRange(in T, long, long)

protected virtual T ClampToRange(in T value, long minRange, long maxRange)

Parameters

value T
minRange long
maxRange long

Returns

T

CloneTo(Binding)

public override void CloneTo(Binding binding)

Parameters

binding Binding

DiffersFrom(T, T)

protected abstract bool DiffersFrom(T first, T second)

Parameters

first T
second T

Returns

bool

GetCallbackMethodInfo()

protected MethodInfo GetCallbackMethodInfo()

Returns

MethodInfo

GetCompressedValue(T)

protected virtual T GetCompressedValue(T value)

Parameters

value T

Returns

T

GetHashCode()

public override int GetHashCode()

Returns

int

GetInterpolatedAt(double)

public abstract T GetInterpolatedAt(double time)

Parameters

time double

Returns

T

GetMemberInfo()

Returns a FieldInfo or PropertyInfo depending on the member type of the target member on the unity component. The MemberInfo is retrieved using reflection but cached to speed up subsequent access.

public override MemberInfo GetMemberInfo()

Returns

MemberInfo

The MemberInfo for the target field or property, or null for Custom member types (e.g., animation parameters).

Exceptions

Exception

Thrown if the member type is neither Field, Property or Custom.

GetValueUsingReflection()

protected object GetValueUsingReflection()

Returns

object

Interpolate(double)

public override void Interpolate(double time)

Parameters

time double

Interpolate(double, T)

protected abstract T Interpolate(double time, T currentValue)

Parameters

time double
currentValue T

Returns

T

InvokeValueSyncCallback()

public override void InvokeValueSyncCallback()

IsDirty(AbsoluteSimulationFrame, out bool, out bool)

public override void IsDirty(AbsoluteSimulationFrame simulationFrame, out bool dirty, out bool justStopped)

Parameters

simulationFrame AbsoluteSimulationFrame
dirty bool
justStopped bool

MarkAsReadyToSend()

public override void MarkAsReadyToSend()

ReadComponentData(ICoherenceComponentData, Vector3)

protected virtual (T value, AbsoluteSimulationFrame simFrame) ReadComponentData(ICoherenceComponentData coherenceComponent, Vector3 floatingOriginDelta)

Parameters

coherenceComponent ICoherenceComponentData
floatingOriginDelta Vector3

Returns

(T value, AbsoluteSimulationFrame simFrame)

ReceiveComponentData(ICoherenceComponentData, AbsoluteSimulationFrame, Vector3)

public override void ReceiveComponentData(ICoherenceComponentData coherenceComponent, AbsoluteSimulationFrame clientFrame, Vector3 floatingOriginDelta)

Parameters

coherenceComponent ICoherenceComponentData
clientFrame AbsoluteSimulationFrame
floatingOriginDelta Vector3

RemoveOutdatedSamples(double)

public override void RemoveOutdatedSamples(double time)

Parameters

time double

ResetLastSentData()

public override void ResetLastSentData()

SampleValue()

public override void SampleValue()

SetToLastSample()

public override void SetToLastSample()

SetValueUsingReflection(object)

protected void SetValueUsingReflection(object value)

Parameters

value object

ValidateNotBound()

public override void ValidateNotBound()

WriteComponentData(ICoherenceComponentData, AbsoluteSimulationFrame)

public override ICoherenceComponentData WriteComponentData(ICoherenceComponentData coherenceComponent, AbsoluteSimulationFrame simFrame)

Parameters

coherenceComponent ICoherenceComponentData
simFrame AbsoluteSimulationFrame

Returns

ICoherenceComponentData