Skip to content

UMageItCombatTextRendererNiagara

Base Class: UMageItCombatTextRendererBase Interfaces: FTickableGameObject

UMageItCombatTextRendererNiagara renders combat text as GPU-driven SDF sprites through a single shared Niagara system. Instead of processing events one at a time, it batches them: every RenderDamage call just appends to PendingEventsBatch, and the whole batch is flushed into the Niagara system’s user parameter arrays once per Tick. This keeps the number of expensive array-update calls constant regardless of how many hits land in a frame, making it the renderer of choice when hundreds of numbers can appear on screen at once.

Each digit of a number is spawned as its own particle, offset horizontally from the number’s center by DigitSpacing, so multi-digit numbers line up correctly.

Tip: SpriteMaterial samples a signed distance field texture atlas — see Generating the SDF Atlas for how to build one with msdf-atlas-gen and keep its glyph order in sync with FindSpriteIndex.


  • MasterSystemAsset (NiagaraSystem*, EditDefaultsOnly): The Niagara System spawned at Initialize. It must read the User.DamageInfo / User.DamageStyle arrays and User.SpawnCount / User.SpawnPulse variables this renderer writes every tick.
  • DefaultTextColor (LinearColor, EditDefaultsOnly): Forwarded to the system as User.DefaultTextColor.
  • OutlineColor (LinearColor, EditDefaultsOnly): Forwarded to the system as User.DefaultOutlineColor.
  • DigitSize (Float, EditDefaultsOnly): Forwarded as User.DigitSize. Default 40.0.
  • DigitSpacing (Float, EditDefaultsOnly): Horizontal offset between digits in a multi-digit number and the value forwarded as User.DigitSpacing. Default 30.0.
  • SpriteMaterial (UMaterialInterface*, EditDefaultsOnly): Forwarded as User.SpriteMaterial — the SDF atlas material sampled per-sprite.
  • ActiveNiagaraComponent (UNiagaraComponent*, BlueprintReadOnly): The single spawned Niagara component all events are batched into.
  • PendingEventsBatch (Array<FMageItCombatTextEvent>): Events accumulated since the last Tick flush.

Spawns MasterSystemAsset via UNiagaraFunctionLibrary::SpawnSystemAtLocation at the world origin (each event carries its own world position through User.DamageInfo, so the component itself doesn’t need to move), and sets the color/size/material user parameters listed above. Sets an internal warmup flag so the first Tick after creation is skipped, giving the Niagara component a frame to finish initializing before arrays are pushed to it.

virtual void RenderDamage_Implementation(const FMageItCombatTextEvent& EventData) override;

Simply appends EventData to PendingEventsBatch. All actual work is deferred to Tick so multiple events landing in the same frame are flushed together.

If the batch is non-empty and the warmup frame has passed, builds two arrays from PendingEventsBatch:

  • User.DamageStyle (Array<Vector4>): one entry per digit — (Style, Scale, SpriteIndex, SpawnPulseCounter). SpawnPulseCounter is a monotonically increasing per-digit counter used by the Niagara system as a random seed.
  • User.DamageInfo (Array<Vector4>): one entry per digit — (Location.X, Location.Y, Location.Z, DigitOffset), where DigitOffset centers each digit horizontally around the number’s location using DigitSpacing.

Then sets User.SpawnCount (total digit count) and User.SpawnPulse (the running counter), and clears the batch.

Calls DestroyInstance() on ActiveNiagaraComponent.


Overridable Functions (Blueprint Native Events)

Section titled “Overridable Functions (Blueprint Native Events)”
  • FindSpriteIndex (EventData) -> Array<Integer> Determines which sprite index in the SDF atlas represents each character of the displayed number. The default implementation returns one index per base-10 digit of Abs(RoundToInt(DamageAmount)).
  • FindDamageStyle (EventData) -> Integer Passed through to Niagara as the Style component of User.DamageStyle. Defaults to 0 — override to vary style by damage type, critical hits, etc.
  • FindScale (EventData) -> Float Passed through to Niagara as the Scale component of User.DamageStyle. Defaults to 1.0.
static TArray<int32> ConvertStringToAlphabetIndices(const FString& InputString, const int32 StartIndex = 0);

(Blueprint Pure) Lowercases InputString and maps each letter a-z to a sequential index starting at StartIndex, skipping non-letter characters. Intended for use inside a custom FindSpriteIndex override, so words like “MISS” or “BLOCK” can be rendered from the same SDF atlas as digits, provided the atlas lays out the alphabet starting at StartIndex.