groupsCommunity
s&box networking gotchas — IsProxy, Sync, Authority, NetworkSpawn, and culling
s&box Networking Gotchas
Common mistakes when building multiplayer games in s&box.
IsProxy vs IsAuthority
IsProxy is true on all clients that don't own the object. Always guard input and authoritative logic:CSHARP
protected override void OnUpdate()
{
if ( IsProxy ) return; // only the owner runs this
HandleInput();
}[Sync] Only Works on Networked Objects
A [Sync] property does nothing if the GameObject isn't networked. The root object must have NetworkMode != None and be spawned via NetworkSpawn().
NetworkSpawn Must Be Called on the Host
CSHARP
// Only the host can network-spawn objects
if ( !Networking.IsHost ) return;
var go = PlayerPrefab.Clone( spawnPos );
go.NetworkSpawn( connection ); // assigns ownership to the connection[Authority] Methods Are Silent No-Ops on Clients
Calling an [Authority] method from a client does nothing — no error, no warning. Use [Broadcast] (client → all) or [Rpc.Host] (client → host) for cross-machine calls.
Sync Vars Don't Interpolate Automatically
[Sync] sends the latest value — it doesn't smooth movement. For smooth networked movement, sync position + velocity and interpolate locally, or use NetworkInterpolation.Connection.All vs Scene.GetAll
Connection.All lists all connected clients. Scene.GetAll<PlayerController>() lists spawned player objects. They can be out of sync briefly during connect/disconnect — always null-check.Destroying Networked Objects
Only the host (or owner, depending on permissions) should destroy networked objects. Clients calling Destroy() on a networked object they don't own will be ignored.
CSHARP
if ( Network.IsOwner )
GameObject.Destroy();AlwaysTransmit = true by Default
All networked objects send updates to all clients by default. For large worlds, implement INetworkVisible and disable AlwaysTransmit to cull distant objects.
Was this helpful?