Network Transform
NetworkTransform
The NetworkTransform
synchronizes the position and rotation of a NetworkObject. Optionally it can also synchronize the scale and parent state in the GameObject hierarchy.
Usage
Add a 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
.
Sync Scale
As the name suggests, this enables syncing of the transform.localScale
value.
Sync Parent
When enabled, the transform.parent
will be synchronized.
There are a few parenting caveats:
- Parent transforms MUST have a
NetworkBehaviour
component. This is how the parent is found, using aNetworkBehaviourId
. - The
NetworkTransform
must 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.
AutoAOIOverride
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.
Teleport()
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.