Table of Contents

OnValueSyncedAttribute

class in Coherence.Toolkit
inherits from Attribute

Specifies a method to be called when the value of a synced field/property changes. This method will be called only for instances whose HasStateAuthority evaluates to false. CoherenceSync.isSimulated).

Remarks

The callback method must meet the following conditions:

* Be 'public'

* Be defined in the same component as the field/property

* Have exactly two parameters

* Type of both parameters must match the type of field/property on which this attribute was applied

Example of a method signature for a field of type 'int': 'public void OnMyValueSynced(int oldValue, int newValue)'

Constructors
OnValueSyncedAttribute
Fields
Callback

Name of the method to be called when value changes. We strongly recommend using the 'nameof()' operator to avoid typing errors (e.g. '[OnValueSyncedAttribute(nameof(OnMyValueSynced)]' ).

Properties
SuppressNotBoundError

If true, fields (or properties) marked with this attribute, but not marked as synced, won't generate any error logs.

SuppressParamOrderError

If true, callbacks with parameter names suggesting invalid order won't generate any error logs.