The Network Transform component synchronizes the position, rotation, and scale of networked game objects across the network.
A game object with a Network Transform component must also have a Network Identity component. When you add a Network Transform component to a game object, Mirror also adds a Network Identity component on that game object if it does not already have one.
By default, Network Transform is server-authoritative unless you check the box for Client Authority. Client Authority applies to player objects as well as non-player objects that have been specifically assigned to a client, but only for this component. With this enabled, position changes are send from the client to the server.
Normally, changes are sent to all observers of the object this component is on. Setting Sync Mode to Owner Only makes the changes private between the server and the client owner of the object.
You can use the Sync Interval to specify how often it syncs (in seconds).
NetworkTransform sends movement updates every
syncInterval over the
Network conditions are never ideal, so those updates may come in out of order, delayed or get dropped somewhere on the way.
Smooth movement over non ideal network conditions is one of the more difficult problems in game networking. Our
NetworkTransform component solves it by using Snapshot Interpolation. We recommend reading through the linked chapter to understand it in detail.
In short, smooth movement over non ideal conditions is achieved through buffering. The worse the conditions, the higher the Buffer Time Multiplier needs to be. However, the higher it is the longer it buffers too.
The total buffer time is calculated by
syncInterval * Buffer Time Multiplier. It's usually recommended to use a factor of '3'.
This means that while you can increase the
Buffer Time Multiplier to make up for worse conditions, you could also decrease the
syncInterval to still keep a reasonably low buffering delay.
Our new Network Transform is already used in production by several real world game projects. Check out this video for a comparison between our old & new NetworkTransform components.
In order to get the new NetworkTransform component, simply update your Mirror version until it looks like the one from the above picture.