Skip to main content

DynamicRef Component

Custom Icon
Base:
UActorComponent
Type:
UNDynamicRefComponent
Header File:
NexusDynamicRefs/Public/NDynamicRefComponent.h

A component which registers and unregisters the owning AActor with the UNDynamicRefSubsystem for future lookup.

DynamicRef Component

Lifecycle​

A single Lifecycle setting (of type ENActorComponentLifecycle) controls both the register and unregister calls — registration always happens during the matching start hook, and unregistration during the paired end hook. This guarantees the two are symmetric.

SettingDisplayRegisters onUnregisters on
BeginPlayBegin PlayBeginPlay()EndPlay()
InitializeComponentInitialize ComponentInitializeComponent()UninitializeComponent()

Choose InitializeComponent when other components' BeginPlay() needs the registration to already be in place; otherwise BeginPlay is the safer default.

References​

A component can claim slots two ways, and both arrays can be populated on the same component:

PropertyTypeUsed For
Fast ReferencesTArray<ENDynamicRef>Fixed-slot lookups via the ENDynamicRef enum (fast array-backed).
Named ReferencesTArray<FName>Free-form FName buckets for ad-hoc keys not covered by ENDynamicRef.
Tag ReferencesFGameplayTagContainerA pre-defined tag system, backed by the FName buckets.

There is no hard limit on the number of entries in the arrays. NDR_None, NAME_None, FGameplayTag::Empty entries are skipped during registration.