Network Transform

NetworkTransform Documentation

The NetworkTransform component allows an object's position, rotation, scale, parent, and active state to be synchronized to other clients. You can have up to 128 Network Transform components per NetworkObject (this number can be exceeded, however it's not recommended).

Namespace

MetaverseCloudEngine.Unity.Networking.Components

Public Properties

  • SyncOptions synchronizationOptions: Synchronization options to use for the Transform component. This allows you to specify which parts of the Transform should be synchronized over the network.

Inspector Fields

  • SyncOptions synchronizationOptions: A bitmask that specifies which parts of the Transform should be synchronized.

Behavior

  • Execution Order: This class inherits from NetworkObjectBehaviour, which uses the ExecutionOrder.Finalize execution order.

Usage

  1. To use NetworkTransform, start by adding the component to a GameObject in your scene. This GameObject should also have a NetworkObject component.

  2. In the inspector, select the synchronizationOptions that you want to use.

  3. The NetworkTransform component will then automatically synchronize the specified parts of the Transform with other clients.

How NetworkTransform Works

The NetworkTransform component works by sending updates to the server whenever the specified parts of the Transform change. The server then broadcasts these updates to all of the clients, which update their local instances of the NetworkObject accordingly.

This ensures that all players see the same position, rotation, scale, parent, and active state for the NetworkObject.

Note: The NetworkTransform component only synchronizes the Transform of the GameObject that it is attached to. If you want to synchronize the Transforms of child GameObjects, you will need to add NetworkTransform components to those GameObjects as well.

Last updated