Network Transform
Overview
export default class CubeManager extends AirshipSingleton {
// This is a reference to a prefab with NetworkIdentity and NetworkTransform
// components
public Cube: GameObject;
// This is a reference to an instantiated cube
private cubeInstance?: GameObject;
public override Start(): void {
if (!Game.IsServer()) return;
// Spawn a cube on the server
this.cubeInstance = Object.Instantiate(
this.Cube,
new Vector3(0, 1, 0),
Quaternion.identity
);
NetworkServer.Spawn(this.cubeInstance);
}
public override Update(dt: number): void {
if (!Game.IsServer() || !this.cubeInstance) return;
// Rotate the cube on the server
this.cubeInstance.transform.Rotate(Vector3.up, 10 * dt);
}
}NetworkTransform
Attaching a NetworkTransform Component

Network Ownership
Last updated