Table of Contents

SyncAttribute

class in Coherence.Toolkit
inherits from Attribute

Marks a variable to be networked.

Remarks

Must be applied to a public field or a property.

Supported types:

  • Primitive types: int, float, double, bool, char, byte, sbyte, short, ushort, uint, long, ulong
  • Composite types: string, byte[], Color, Vector2, Vector3, Quaternion
  • Unity Object types: GameObjects and Components (read note below).
  • Network identification types: ClientID and Entity.

When syncing Unity Object types, only the reference to the object is synced, not the actual data of the object. GameObjects and Components will only get synced if they are part of a CoherenceSync prefab. Internally, what's synced is the Entity ID associated with the CoherenceSync prefab.

When using this attribute successfully, the variable will be added to the Bindings list. Variables with this attribute will appear on the Configure window as synced, and can only be unsynced by removing the attribute and them unchecking them in the Configure window. Variables without this attribute can be marked as synced via the Configure window directly.

Constructors
SyncAttribute
Fields
DefaultSyncMode

Sets the sync mode on the binding.

Properties
OldName

How this variable was previously known as.

See Also