how to make the numbers of the damage appear when dealing damage

how to make the numbers of the damage appear when dealing damage.

there are a few different methods, and most of them come back to it will probably be a string, that is being applied to an element in a Widget

if that Widget belongs to the thing being damaged (the number appears above the health bar, or does a floating/bouncy thing like Boarderlands or Diablo)

or if the enemy’s health bar is somewhere in a fixed position of the players screen then it would belong to the players UI Widget (similar to boss fights in a From Soft game)

almost regardless when you are just about to call your implemented DealDamage()/TakeDamage() or what not then call a function that sets the string of your widget flavor to the amount of damage dealt, or to be dealt.

I used to use a souls-like widget. A bar with a text-field that was always hidden, but on-hit would be made visible. That same function would then call a timer which then ~2 seconds later, called a 2nd function to hide the widget.

Set the progress on the bar to the % of critter-health and the text to the currently-applied damage (passed when initially made visible).

I’m currently going through an overhaul of the UI based on stuff they do in Lyra, with baking in progress-bars, inventory-icons, and whatnot just-in-the-material. Ideally, I’d just have a basic widget with just-a-material, and run the UI like that (more lightweight). It does overheat, ammo-counters, etc, etc… It’s REALLY cool.

This is the reference video I am using, he gets more in-depth with what I am talking about in the latter-half, but watch the whole thing: Lyra Cross-platform UI Development | Tech Talk | State of Unreal 2022 - YouTube

Also, tangentially (lol), the Epic Material UI lab (available in the marketplace) has a lot of practical examples of what that video is doing, so you can use them and pick them apart.