Is there no simple way to render text or numbers using Niagara? I’m looking to replace my widget floating damage numbers with lightweight emitters, but it seams like the only way is to piece together individual character textures?
My current solution against 30 enemies costs me 4ms on the game thread while attacking all 30 every 0.1s. With damage numbers turned off there’s only a 0.5ms increase so it’s not my attacks doing it. It’s just far too much. What I’m doing is using a non-ticking container on each enemy that spawns a child widget with the damage numbers. The animation applied is a fade out.
Seams like my best option is to attach a widget component to the actor and pre-load it with 5-10 floating damage number text nodes. Then go through them enabling/disabling visibility. Basically they’re just pooled. This avoids the widget create/destroy cost, which seams to be extremely high (even more than actor spawn… wild).
The material editor has this really handy material function called “Debug Scalar Values.” I usually use it to check my math, but funnily enough I think this is exactly what you’re looking for.
If you set up your “Number of Digits” and your “Number” to a dynamic material parameter, you can change these values in your emitter on the fly. (Let me know if you need help with that)
The actual material function is a very complicated setup. If you’re looking to remove the decimal place, you can do so here:
That’s a debug function though. I don’t think that’ll work in a packaged build. I also need to be able to output text/icons (e.g. IMMUNE, BLOCKED, etc…).
So far my widget pooling is working. I’ve 10 child widgets that just get worked through. Took 4ms of gamethread time down to 0.5ms of gamethread time. So it was purely the create/destroy of child widgets causing this massive gamethread time loss. It would be great though if UE had a built in way to render text in niagara. Seams really strange there isn’t a text renderer built into it.
Ok, went with my simplified approach. Basically the widget contains 5 child widgets. Using a multigate I jump through them and set their text and play their animation. So while I can only show 5 floating text per enemy at any given time it’s more than enough as anything more is just clutter. These 5 can then all be optimized as much as possible. Effectively it’s just widget pooling. Substantially improved my performance so will just continue with this approach.