TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/facepunch/sbox-public/llms.txt
Use this file to discover all available pages before exploring further.
[Sync] attribute tells s&box to automatically replicate a component property from the owner to every other connected client. This page covers how [Sync] works, what SyncFlags control, and how to enable smooth interpolation between network ticks.
Adding [Sync] to a property
Decorate any public property on a component with[Sync] to have its value sent over the network whenever it changes:
Health, the new value is queued for transmission and applied on all remote clients before any RPC that references the same object fires.
[Sync] properties are sent reliably by default. The current value is always
up-to-date on remote clients before an RPC is delivered on that object.What types can be synced?
Any serializable value type works:bool, int, float, double, string, Vector3, Rotation, Angles, Transform, Color, enums, and structs made up of those types. Reference types (classes) are not directly supported.
Who sends the sync?
By default the owner of theNetworkObject is the sender, and all other clients receive the value as read-only. The host controls objects that have no owner (IsUnowned == true).
SyncFlags.FromHost
To make the host the authoritative writer — regardless of who owns the object — addSyncFlags.FromHost:
[HostSync] attribute, which was a shorthand for [Sync( SyncFlags.FromHost )]. Prefer the SyncFlags form in new code.
SyncFlags reference
Pass flags to the[Sync] constructor to change synchronization behaviour. Flags can be combined with |.
| Flag | Description |
|---|---|
SyncFlags.FromHost | The host is the authoritative writer, not the owner. |
SyncFlags.Query | The engine polls the getter each tick for changes instead of relying on the setter being called. Use this when the value can change without going through the property setter. |
SyncFlags.Interpolate | The received value is interpolated between ticks on remote clients. Supported for float, double, Angles, Rotation, Transform, and Vector3. |
Interpolation
WhenSyncFlags.Interpolate is set, the engine maintains an InterpolatedSyncVar<T> buffer for the property. On remote clients the getter returns a smoothed value sampled at Time.Now - Networking.InterpolationTime (100 ms by default), which eliminates the jitter you would see if you rendered the raw network-tick value directly.
Supported interpolation types
| Type | Notes |
|---|---|
float | Linear interpolation |
double | Linear interpolation |
Vector3 | Component-wise lerp |
Rotation | Slerp |
Angles | Component-wise lerp |
Transform | Position lerp + rotation slerp |
IInterpolator<T> is also supported, allowing you to provide custom interpolation logic.
Reliable vs. unreliable delivery
[Sync] values are transmitted via the reliable data table path by default, meaning the engine guarantees delivery and ordering. For values you mark with SyncFlags.Query, changes are included in the unreliable snapshot stream that is broadcast every network tick, so they may arrive slightly later than values changed through the setter.
Reading sync values safely
On proxy clients,[Sync] properties are read-only by convention — writing to them from a non-owner has no effect on remote machines. Guard against accidental writes with the IsProxy check:
Combining [Sync] with RPCs
Synced values are flushed before an RPC is delivered on the same object, so you can safely read them inside an RPC handler:NetworkFlags and transform sync
For theGameObject transform itself (position, rotation, scale), use NetworkFlags rather than [Sync]. See Networking overview for the full flag list.
Next steps
RPCs
Trigger behaviour on remote clients with
Rpc.Broadcast, Rpc.Host, and Rpc.Owner.Networking overview
Understand the host/client model, ownership, and
NetworkObject.