Class ValueBinding<T>
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
DescriptorunityComponent
Component
Fields
valueSyncNew
protected T valueSyncNew
Field Value
- T
valueSyncOld
protected T valueSyncOld
Field Value
- T
valueSyncPrepared
protected bool valueSyncPrepared
Field Value
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
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
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
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
Tsecond
T
Returns
GetCallbackMethodInfo()
protected MethodInfo GetCallbackMethodInfo()
Returns
GetCompressedValue(T)
protected virtual T GetCompressedValue(T value)
Parameters
value
T
Returns
- T
GetHashCode()
public override int GetHashCode()
Returns
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
Interpolate(double)
public override void Interpolate(double time)
Parameters
time
double
Interpolate(double, T)
protected abstract T Interpolate(double time, T currentValue)
Parameters
time
doublecurrentValue
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
AbsoluteSimulationFramedirty
booljustStopped
bool
MarkAsReadyToSend()
public override void MarkAsReadyToSend()
ReadComponentData(ICoherenceComponentData, Vector3)
protected virtual (T value, AbsoluteSimulationFrame simFrame) ReadComponentData(ICoherenceComponentData coherenceComponent, Vector3 floatingOriginDelta)
Parameters
coherenceComponent
ICoherenceComponentDatafloatingOriginDelta
Vector3
Returns
ReceiveComponentData(ICoherenceComponentData, AbsoluteSimulationFrame, Vector3)
public override void ReceiveComponentData(ICoherenceComponentData coherenceComponent, AbsoluteSimulationFrame clientFrame, Vector3 floatingOriginDelta)
Parameters
coherenceComponent
ICoherenceComponentDataclientFrame
AbsoluteSimulationFramefloatingOriginDelta
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
ICoherenceComponentDatasimFrame
AbsoluteSimulationFrame