UMageItCombatTextRendererUMG
Base Class: UMageItCombatTextRendererBase
Interfaces: FTickableGameObject
Overview
Section titled “Overview”UMageItCombatTextRendererUMG renders combat text as pooled UMageItCombatTextWidget instances
placed directly in the viewport. It is the most flexible renderer — full UMG animation, easy per-widget Blueprint
logic — at the cost of one pooled widget per concurrent on-screen number.
Its defining feature is damage accumulation: repeated hits on the same TargetActor update the same widget
instead of spawning a new one, growing the displayed number and resetting its fade-out timer.
Configuration Properties
Section titled “Configuration Properties”PoolSize(Integer,EditDefaultsOnly, min1): Number of widgets pre-allocated atInitialize. Default10.MaxPoolSize(Integer,EditDefaultsOnly, min0): Hard ceiling on total widget count (including the initialPoolSize) the pool may grow to when exhausted, instead of dropping the damage event.0= unbounded growth. Values belowPoolSizehave no effect.LocationInterpSpeed(Float,EditDefaultsOnly): Interpolation speed used to smoothly move a widget’s tracked world position towards its target. Default15.0.bTrackActorLocation(Boolean,EditDefaultsOnly): Whether the widget follows itsTargetActoras it moves after spawning.bUpdateLocation(Boolean,EditDefaultsOnly): Whether new damage events on an already-active target update its tracked position.bSmoothLocationUpdate(Boolean,EditDefaultsOnly): When a new event updates the position, whether to interpolate towards it (true) or snap immediately (false).ScreenLocationOffset(Vector2D,EditDefaultsOnly): Constant pixel offset applied to the final projected screen position.WidgetClass(TSubclassOf<UMageItCombatTextWidget>,EditDefaultsOnly): The widget class instantiated for the pool.
Read-Only / Internal
Section titled “Read-Only / Internal”WidgetPool(Array<UMageItCombatTextWidget*>): Widgets available for reuse.ActiveWidgets(Map<WeakObjectPtr<AActor>, FMageItWidgetTrackingData>): Widgets currently assigned to a target actor. SeeFMageItWidgetTrackingData.
Methods (Functions)
Section titled “Methods (Functions)”ReturnWidgetToPool
Section titled “ReturnWidgetToPool”void ReturnWidgetToPool(UMageItCombatTextWidget* Widget);(Blueprint Callable) Pushes Widget back onto WidgetPool and removes it from ActiveWidgets — but only if
Widget is still the one tracked as active for its TargetActor. This guards against a stale call (e.g. a
FadeOut timer that outlived a pool reset) returning the same widget to the pool twice. Called automatically by
UMageItCombatTextWidget::FadeOut — you normally don’t call this directly.
Lifecycle Overrides
Section titled “Lifecycle Overrides”Initialize_Implementation
Section titled “Initialize_Implementation”Calls the internal EnsurePool(), which resolves the local player’s PlayerController and, since the pool hasn’t
been built for it yet, pre-allocates and hides PoolSize widgets — adding each to the viewport (Collapsed
visibility, centered alignment) so later reuse doesn’t pay CreateWidget cost.
Note: The renderer instance outlives level travel, but the
PlayerControllerand the widgets built against it don’t.EnsurePool()remembers which controller its current pool belongs to and, ifRenderDamageorTickever sees a different (or newly re-resolved) controller, tears the old pool down and rebuilds it from scratch — so you don’t need to re-register this renderer after a level transition.
RenderDamage_Implementation
Section titled “RenderDamage_Implementation”First resolves the target actor from EventData.TargetActor, falling back to EventData.HitInfo.GetActor(). If
neither is present, logs a Warning and drops the event — this renderer has no concept of a damage number that
doesn’t track an actor. Then calls EnsurePool() (covering the level-travel case above) and only continues if the
pool is ready:
- If the actor already has an active widget, calls
UpdateDamageon it (accumulation) and updates its tracked target position according tobUpdateLocation/bSmoothLocationUpdate. - Otherwise, pulls a widget from the pool (or grows the pool if under
MaxPoolSize) via the internalUseWidget, sets its initial position, and callsFadeIn. - If the pool is exhausted and can’t grow, logs a
Warningand drops the event.
Re-resolves PlayerController (see the level-travel note above) and returns early if there’s still none, or if
ActiveWidgets is empty. Otherwise, for every active widget: optionally accumulates the target actor’s movement
delta into a target position (bTrackActorLocation), interpolates the widget’s current world position towards it
(LocationInterpSpeed), projects that position to screen space via PlayerController->ProjectWorldLocationToScreen,
and calls SetPositionInViewport (plus ScreenLocationOffset). Gated overall by IsTickable/CanTick,
so it stops running entirely once Shutdown has been called.
Shutdown_Implementation
Section titled “Shutdown_Implementation”Empties ActiveWidgets, removes every pooled widget from the viewport, and forgets the controller the pool was
built for, before calling the parent implementation (which marks the renderer as shut down — see
UMageItCombatTextRendererBase).