I’m looking to use the Niagara system to spawn damage numbers, since its more efficient than UMG, but I’m not managing to make it work with the Gameplay Cue of the GAS.
In my case, I need the particle system to spawn multi-digit numbers or sometimes texts like status effects and in most tutorials that I’ve found, there is some custom logic that needs to be calculated to spawn the digits using Niagara. But I’ve struggled to make it work within Gameplay Cues, because I keep running into errors that relates to running these functions or the changing variables within them.
So I’m stuck on how to make this work, not sure if maybe I’m setting up the function incorrectly and I’ve been stuck on this for a while now, thinking it was straight forward thing to do. Here are the tutorials I tried to follow but couldn’t get to work via Gameplay Cues:
We need more info on what is failing… can you get the numbers to display using some test dummy numbers? How are you passing your damage value to the GameplayCue?
The usual trap with GameplayCues is that the cue notify classes are shared/non-instanced. A GameplayCueNotify_Static is a CDO, so you can’t keep or change member variables on it at runtime, and that’s where most “errors when changing variables” come from. Two setups that work reliably:
1. Keep the cue dumb and move the digit logic elsewhere. In the GCN (Static is fine), override OnExecute, read the damage from Parameters.RawMagnitude (set it from your Execution/GE via the cue’s magnitude, or pass it through EffectContext / Parameters.SourceObject), and then hand that number to a component on the target actor (e.g. a DamageNumberComponent) that owns the Niagara system and does the int-to-digits conversion. The component can keep state; the cue cannot.
2. If you want the cue to spawn the Niagara directly, use a GameplayCueNotify_Actor (instanced) or the newer GameplayCueNotify_Burst, spawn the system with Spawn System Attached, then push data with the Niagara Data Interface Array functions (Set Niagara Array Int32 / Float) for the digit indices, plus a User.Count or spawn-burst parameter. Don’t rely on User Parameters you set before activation if the system pools, set them after spawning.
For text like status effects, it is easier to bake those words into the same atlas as extra frames and just push their frame index. As Countsie said, first test with a hardcoded value like 1234 from OnExecute; if that shows up, the problem is only the magnitude plumbing, and checking that RawMagnitude is non-zero (print it) will tell you quickly.
chen is right about the cue side, keep the notify dumb and read RawMagnitude in OnExecute. the niagara half is then just pushing that number into the particle system before it spawns, one user parameter for damage and one for the text mode.
most tutorials do the digit math inside niagara which gets messy with GAS. do the digit splitting in the cue where you have the magnitude, pass the results as plain ints, and let niagara only render them.