menu_bookDocumentation

[Sync] Attribute: SyncFlags.FromHost, SyncFlags.Interpolate, SyncFlags.Query — How Property Sync Works

calendar_today May 4, 2026 schedule ~2 min read person patrickjr verified 50

[Sync] Attribute: SyncFlags and How Property Synchronization Works

The [Sync] attribute marks a component property for automatic network synchronization from the owner to all other clients. The engine's source generator wraps the property getter and setter with sync_GetValue and sync_SetValue at compile time.

SyncFlags

CSHARP
[Flags]
public enum SyncFlags : uint
{
    FromHost  = 1,   // Host controls this value, not the owner
    Query     = 2,   // Poll the getter each tick instead of relying on the setter being called
    Interpolate = 4  // Interpolate between ticks (float, double, Angles, Rotation, Transform, Vector3 only)
}

Usage

CSHARP
// Basic sync — owner sends to everyone
[Sync] public float Health { get; set; }

// Host-controlled sync (replaces obsolete [HostSync])
[Sync( SyncFlags.FromHost )] public int Score { get; set; }

// Interpolated sync — smooth movement on proxies
[Sync( SyncFlags.Interpolate )] public Vector3 Velocity { get; set; }

// Query mode — value is polled each tick (use when getter can change without setter being called)
[Sync( SyncFlags.Query )] public float SomeComputedValue { get; set; }

// Combined flags
[Sync( SyncFlags.FromHost | SyncFlags.Interpolate )] public Vector3 HostPosition { get; set; }

How It Works Internally

Important: Sync Only Works on Networked Objects

[Sync] properties only synchronize when the GameObject has been spawned on the network (NetworkMode.Object). On non-networked objects, the setter just sets the backing field normally.
Was this helpful?