Creating simple UI meters with UMG
To create an HUD (short for Heads-up Display) that will display the amount of health, stamina, and ammo the player currently possesses, we will first need to create variables within the player character that can track these values. To do so, open the FirstPersonCharacter Blueprint from the Blueprints
folder of your project. Within the Blueprint, we are going to define variables that will represent additional states that the player and game will care about. Find the Variables category of the My Blueprint panel in the editor. Click on the + sign to add another variable, and call it PlayerHealth
. With PlayerHealth selected, find the Details panel and change the variable type to Float.
Also ensure that the box labeled Editable is checked so that other Blueprints and objects can manipulate this variable. When a variable is made editable, it will be shown with a yellow open eye symbol next to its name in the Variables section of the My Blueprint panel.
Follow...