RSX Code Reference
    Preparing search index...
    • rsx
    • netReplicate

    Function netReplicate

    • 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.

      Type Parameters

      • T = any

        The field type for type-safe compareFn.

      Parameters

      Returns AttributeDecorator<Attribute>

      @netReplicate()
      public health: number = 100;
      @netReplicate({ threshold: 0.5 })
      public velocity: number = 0;
      @netReplicate({ positionThreshold: 0.1 })
      public targetPosition: Vector3 = Vector3.zero;
      @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();