UMageItCombatTextSubsystem
Base Class: ULocalPlayerSubsystem
Overview
Section titled “Overview”UMageItCombatTextSubsystem is the single entry point for spawning combat text. Being a ULocalPlayerSubsystem, it
is automatically instantiated per local player, making it highly efficient and easy to access without manual
initialization.
It owns a map of renderer instances (ActiveRenderers), keyed by FGameplayTag, and is responsible for resolving
which renderer should handle a given event, initializing it (lazily by default, or eagerly for renderers opted into
bInitializeAtBeginPlay), and shutting all of them down when the player is deinitialized.
How to Access
Section titled “How to Access”In Blueprints
Section titled “In Blueprints”Right-click anywhere in an Event Graph and search for Get MageItCombatTextSubsystem.
In C++
Section titled “In C++”if (APlayerController* PC = GetWorld()->GetFirstPlayerController()){ if (ULocalPlayer* LocalPlayer = PC->GetLocalPlayer()) { UMageItCombatTextSubsystem* CombatTextSubsystem = LocalPlayer->GetSubsystem<UMageItCombatTextSubsystem>(); }}Properties (Variables)
Section titled “Properties (Variables)”ActiveRenderers(Map<GameplayTag, UMageItCombatTextRendererBase*>,BlueprintReadOnly): Renderer instances created so far, keyed by the leafFGameplayTagthat first requested them.
Methods (Functions)
Section titled “Methods (Functions)”Initialize
Section titled “Initialize”virtual void Initialize(FSubsystemCollectionBase& Collection) override;Called automatically by the engine when the local player subsystem is created. Reads
UMageItCombatTextSettings::RendererRegistry and calls GetRenderer up front for every entry
whose bInitializeAtBeginPlay is true, warming those renderers up immediately instead of waiting
for their first damage event. All other entries remain lazy.
GetRenderer
Section titled “GetRenderer”UMageItCombatTextRendererBase* GetRenderer(const FGameplayTag DamageTag);(Blueprint Callable) Lazily loads and initializes the renderer for DamageTag, returning the cached instance on
subsequent calls.
Resolution order:
- Look up
DamageTagdirectly inActiveRenderers. Return immediately if found. - Otherwise, read
UMageItCombatTextSettings::RendererRegistryand walk up the tag hierarchy —DamageTag, thenDamageTag.RequestDirectParent(), and so on — until an entry with a non-nullRendererClassis found. - Synchronously load the resolved
RendererClass, construct a new renderer instance (NewObject), callInitializeon it, and cache it inActiveRenderersunder the original leaf tag (not the ancestor tag that resolved the class), so repeated lookups for that exact leaf tag are O(1). - Returns
nullptrif no tag anywhere up the hierarchy has a registered renderer class.
AddDamageEvent
Section titled “AddDamageEvent”void AddDamageEvent(const FMageItCombatTextEvent& Event);(Blueprint Callable) Resolves the renderer for Event.DamageTag via GetRenderer and forwards the event to its
RenderDamage. If no renderer resolves, logs a Warning to the LogMageitCombatText category and drops the event.
Deinitialize
Section titled “Deinitialize”virtual void Deinitialize() override;Calls Shutdown() on every active renderer and empties ActiveRenderers. Called automatically by the engine when
the local player subsystem is torn down.