I want to make a death counter that is up in the corner and counts up to a million if it has tto, but resets after every level. Help?

I want to make a death counter that is up in the corner and counts up to a million if it has tto, but resets after every level. Help?

Here’s what I would do:

  1. Add a variable to your pawn called “deaths”. It should probably be an int, as you can’t have half a death (I assume).
  2. Create a new widget called “HUD” (unless if you already have a HUD, in which case you should use that).
  3. Add a horizontal box to the corner of this widget’s canvas panel.
  4. Place two text items in the horizontal box.
  5. Set the first text block to "Deaths: " (or whatever you want)
  6. Where the second text block has space for text to be put in, click the ‘bind’ button instead.
  7. Select “Create Binding”
  8. Add a “Cast to [your pawn’s class]” node between the two existing nodes.
  9. Use “Get player pawn” to fulfill the “object” input.
  10. Use the “As [pawn class]” node to create a “Get Deaths” node.
  11. Drag the output from the “Get Deaths” node into the return node.
  12. To the BeginPlay event on the pawn, append a “Create Widget” node.
  13. Set the class to “HUD”.
  14. Append an “Add to Viewport” node to this, using the return value from the previous node.

And that should do it! The counter should reset when you change levels automatically, unless if you found a way to preserve the pawn. You can change the names here if it is to your liking.