You are viewing documentation for v1.1. Switch to current version โ†’

๐Ÿงฐ AutoReplication Helper Macros

Short Description

Macros that wire AutoReplication mixins into QoL classes and replication arrays.

Long Description

These macros initialize additional data entries, wire relay components, and register replicated arrays for AutoReplication. They are intended for use inside QoL class implementations.

๐Ÿš€ Features

  • Initialize additional data and instanced Object Variables.
  • Optionally bind the RPC relay component.
  • Declare default OnRep handlers and replication props.

๐Ÿ“š Usage Examples

void AGorgeousPlayerController::InitAdditionalData(bool bActivateNetworkingCapabilities)
{
    UE_DECLARE_AUTOREPLICATION_CLASS_INIT_INVOKE_ADDITIONAL_DATA_WITH_RELAY;
}

UE_DECLARE_AUTOREPLICATION_CLASS_INIT_INVOKE_ADDITIONAL_DATA

Initializes the AutoReplication mixin and invokes instanced functionality for each default Object Variable entry.

This macro expands inline; call it inside the owning class implementation.

UE_DECLARE_AUTOREPLICATION_CLASS_INIT_INVOKE_ADDITIONAL_DATA;

UE_DECLARE_AUTOREPLICATION_CLASS_GET_LIFETIME_REPLICATED_PROPS

Registers the AutoReplication replicated array with Unreal's replication system.

Parameter Name Type Description
Class type The owning QoL class type.
UE_DECLARE_AUTOREPLICATION_CLASS_GET_LIFETIME_REPLICATED_PROPS(AGorgeousPlayerController);

Best Practices

  • Use the relay-enabled macro when the owning class has an RPC relay component.
  • Keep macro usage centralized in the class implementation file.

Troubleshooting

  • If replicated variables do not update, verify the macro is used in GetLifetimeReplicatedProps.