Table of Contents

NetworkTransform & NetworkTransformHierarchy

VIROO's NetworkTransform component is a fundamental component for the synchronization of transforms. The NetworkTransform replicates a Unity Transform's position, rotation, and scale across clients, ensuring all players see the same object representation. The NetworkTransform is a NetworkBehaviour.

Synchronize Transform

To synchronize a Transform you need to add the following components:

  1. NetworkObject: VIROO Networking component. This component may be at the same level as the NetworkTransform, or it may be in any parent in the hierarchy.
  2. NetworkTransform: VIROO Networking component.
  3. NetworkTransformSettings: VIROO Networking component.

NetworkObject

Used to uniquely identify a GameObject. For more information view NetworkObject.

NetworkTransform

The main component used to synchronize a Transform through the Network.

network-transform.png

NetworkTransform
Field Description
Behaviour Id The identifier of the Behaviour. It's automatically assigned.
Persist Type Here you can specify what kind of persistence you want the NetworkTransform to have between None, Last or All, where None is no persistence, Last is the last values set to the transform and All is all values set to the transform. The value for this component should be Last. For more information view Persistence.
Update Type Here you can choose in which Unity update cycle you want the NetworkTransform to run: Update, FixedUpdate or LateUpdate.

NetworkTransformHierarchy

Like the NetworkTransform component, the NetworkTransformHierarchy is in charge of synchronizing the position, rotation and scale of a Transform in Unity. The difference is that the NetworkTransformHierarchy synchronizes the Transform in which it's assigned and also all its children in the hierarchy.

network-transform-hierarchy.png

NetworkTransformHierarchy
Field Description
Behaviour Id The identifier of the Behaviour. It's automatically assigned by the system.
Persist Type Here you can specify what kind of persistence you want the NetworkTransform to have between None, Last or All, where None is no persistence, Last is the last values set to the transform and All is all values set to the transform. The value for this component should be Last. For more information view Persistence.
Update Type Here you can choose in which Unity update cycle you want the NetworkTransform to run: Update, FixedUpdate or LateUpdate.
Auto Initialize If checked, the component will synchronize all the transforms in its hierarchy. If this property isn't checked, instead of automatically finding getting references to the transforms in its hierarchy, the list of specific Transforms to synchronize must be specified by scripting to the component.

NetworkTransformSettings

This component is used in conjunction with NetworkTransform and NetworkTransformHierarchy, and is used to configure their behaviour.

With the NetworkTransform component, the NetworkTransformSettings has to be set in the same GameObject where the NetworkTransform is located.

With the NetworkTransformHierarchy component, the NetworkTransformSettings has to be set in the same GameObject where the NetworkTransformHierarchy is located. Additionally, NetworkTransformSettings components can be set in each of the transforms in the hierarchy that's being synchronized to establish different values for that specific Transform.

If no other NetworkTransformSettings is found in specific Transforms, the settings set in the NetworkTransformSettings in the same GameObject as the NetworkTransformHierarchy are used by default.

network-transform-settings.png

NetworkTransformSettings
Field Description
Should Synchronize This field is used to set if the Transform that has this component is going to be network synchronized. To prevent a specific Transform from being synchronized within a NetworkTransformHierarchy, uncheck this field.
Update Interval Indicates how often, in seconds, the script will check if the conditions to consider that the transform has changed are met.
Min Distance This is the min distance in m the Transform has to move to send a new position update.
Min Angle This is the max angle that the Transform has to rotate to send an update of its rotation.
Min Scale This is the min value in m that the scale has to change to send a new update.
Local This field is used to set whether the Transform synchronization is to be performed in Local or Global space.
Smooth Position Time This is the amount of smoothing applied when interpolating the current position with the target position in the users receiving the transform data.
Smooth Rotation Time This is the amount of smoothing applied when interpolating the current rotation with the target rotation in the users receiving the transform data.