Marks a field for automatic network synchronization across connected clients.
When a synced field changes, the new value is automatically broadcast to all users in the room.
Primitives (string, number, boolean) sync automatically.
For arrays/objects, reassign to trigger sync: this.myArray = this.myArray
Example: Basic sync
classMyComponentextendsBehaviour { @syncField() playerScore: number = 0; }
Example: With change callback
classMyComponentextendsBehaviour { @syncField("onHealthChanged") health: number = 100;
Marks a field for automatic network synchronization across connected clients.
When a synced field changes, the new value is automatically broadcast to all users in the room.
Primitives (string, number, boolean) sync automatically.
For arrays/objects, reassign to trigger sync:
this.myArray = this.myArrayExample: Basic sync
Example: With change callback
Example: Preventing sync (one-way)
See
serializable for editor serialization
Link
https://engine.needle.tools/docs/how-to-guides/networking/