DynamicRef Object
- Base:
- UObject
- Type:
- UNDynamicRefObject
- Header File:
- NexusDynamicRefs/Public/NDynamicRefObject.h
A UObject wrapper around a single ENDynamicRef slot or FName bucket, giving Blueprints and UMG widgets a referenceable handle that can be bound into a list view. It is the shape the Developer Overlay uses to feed UNDynamicRefListViewEntry rows; custom debug UIs can use it the same way.
What It Is​
- Slot or Bucket: Each instance targets exactly one ENDynamicRef value or one
FName. The two factory overloads pick the mode at creation time; whichever is unset reads asNDR_None/NAME_None. - Mirrored State: Holds its own
TArray<TObjectPtr<UObject>>that mirrors the registrations the UNDynamicRefSubsystem currently has for that slot/bucket. The wrapper does not query the subsystem — it is fed viaAddObject/RemoveObjectby whatever owns it. - Change Notification: Fires its
ChangedFSimpleDelegateafter every add/remove so bound UI can refresh without polling.
Creation​
Use one of the two static factories rather than NewObject directly:
UNDynamicRefObject* Obj = UNDynamicRefObject::Create(OverlayWidget, ENDynamicRef::NDR_Player);
UNDynamicRefObject* Obj = UNDynamicRefObject::Create(OverlayWidget, FName("MyCustomBucket"));
The wrapper is created RF_Transient and remembers its Outer (typically the overlay widget). The Outer is also cast to a UNDynamicRefsDeveloperOverlay and stored — pass any other UObject and GetOverlay() will return nullptr.
API​
| Method | Returns / Effect |
|---|---|
GetDynamicRef() | The targeted ENDynamicRef slot. Meaningful only when GetTargetName() is NAME_None. |
GetTargetName() | The targeted FName bucket. NAME_None when the wrapper targets a slot. |
AddObject(UObject*) | Appends the object to the mirrored list and broadcasts Changed. |
RemoveObject(UObject*) | Removes the object from the mirrored list and broadcasts Changed. |
GetCount() | Number of objects currently mirrored. |
GetReferenceText() | Display label — the FName when set, otherwise the ENDynamicRef's display name. |
GetObjects() | Mutable view of the mirrored list (native only). |
The wrapper holds raw pointers via TObjectPtr but is not a source of truth — it can drift from the UNDynamicRefSubsystem if you forget to call AddObject / RemoveObject in response to the subsystem's OnAdded / OnRemoved delegates. The Developer Overlay handles this wiring; if you build a custom UI on top of these wrappers, mirror that pattern.