menu_bookDocumentation
Networked Objects: NetworkSpawn, Interpolation, and Network Modes
Any GameObject can become a networked object by calling NetworkSpawn() on it. It will then be sent to all clients and can have Sync Properties and RPC Messages.
Network Mode
| Mode | Behaviour |
|---|---|
| NetworkMode.Never | Never networked to others |
| NetworkMode.Object | Sent to other clients as its own networked object with sync properties and RPCs |
| NetworkMode.Snapshot (default) | Host sends this as part of the initial scene snapshot when a client joins |
Interpolation
By default, the transform of all networked objects is interpolated smoothly for other clients.
Disable interpolation:
CSHARP
Network.DisableInterpolation();Clear interpolation (teleport):
CSHARP
Transform.Position = Vector3.Zero;
Network.ClearInterpolation();Refreshing a Networked Object
Once you call NetworkSpawn(), further changes to components or hierarchy are not automatically networked. If you add new components, change enabled state, or modify hierarchy, call Network.Refresh() to send updates to other clients.
By default only the host can send refresh updates. Enable owner refresh via connection permissions.
Was this helpful?