NetworkTransform component is derived from
NetworkTRSP and can be added to any Unity GameObject to automate synchronization of its Transform position and rotation states, and optionally scale and parent states.
NetworkTransform component the root or any child of a Network Object, to replicate changes to that Transform's state.
NOTE: Parent synchronization is only applicable to
NetworkTransform components on the root of a
NetworkObject, as they must represent the MainTRSP.
As the name suggests, this enables syncing of the
When enabled, the
transform.parent will be synchronized.
There are a few parenting caveats:
- Parent transforms MUST have a
NetworkBehaviourcomponent. This is how the parent is found, using a
NetworkTransformmust be on the root of the Network Object. Parenting is only for nested Network Objects, you cannot rearrange the children of a single Network Object.
- The parent transform can be a child transform of a Network Object. For example the hand of a player.
When enabled, parented Transforms will automatically set their
AreaOfInterestOverride to any nested parent
NetworkObject, ensuring that children objects have the same Player Interest as any parent
NetworkObject. For example, if a Player is carrying an Object, that Object would only be updated to other players who are getting updates for the Player carrying that Object.
For more info on the
SetAreaOfInterstOverride see the
NetworkTRSP section of this manual here.
Calling this sets the transform's position and rotation to the indicated values, and networks the Teleport event. This will suspend interpolation in
Render() between the previous tick state and the current tick state, creating an instantaneous non-lerped transition to the Teleport state.