Marks a field for network replication with optional threshold and comparison configuration. When the engine performs replication-only serialization or diff generation, only fields decorated with @netReplicate() are included.
@netReplicate()
The field type for type-safe compareFn.
Optional
Optional threshold and comparison configuration.
@netReplicate()public health: number = 100; Copy
@netReplicate()public health: number = 100;
@netReplicate({ threshold: 0.5 })public velocity: number = 0; Copy
@netReplicate({ threshold: 0.5 })public velocity: number = 0;
@netReplicate({ positionThreshold: 0.1 })public targetPosition: Vector3 = Vector3.zero; Copy
@netReplicate({ positionThreshold: 0.1 })public targetPosition: Vector3 = Vector3.zero;
@netReplicate({ rotationThreshold: 0.05 })public targetRotation: Quaternion = Quaternion.identity; Copy
@netReplicate({ rotationThreshold: 0.05 })public targetRotation: Quaternion = Quaternion.identity;
@netReplicate<MyCustomType>({ threshold: 0.1, compareFn: (lhs, rhs) => Math.abs(lhs.customMetric - rhs.customMetric)})public complexData: MyCustomType = new MyCustomType(); Copy
@netReplicate<MyCustomType>({ threshold: 0.1, compareFn: (lhs, rhs) => Math.abs(lhs.customMetric - rhs.customMetric)})public complexData: MyCustomType = new MyCustomType();
Marks a field for network replication with optional threshold and comparison configuration. When the engine performs replication-only serialization or diff generation, only fields decorated with
@netReplicate()are included.