Create a Material called M_HUD
Create texturesampleparameter 2D, name as SlateUI, set sample source and material expression as follow:
Connect as below (to stop seeing the UI even in front of us)
select M_HUD node, tick didsable depth text (make sure UI appear in front of everything)
Create a HUD Widget, add progress bar and text, set bar style, appearance and progress as follow:
Go to graph, add variable , then bind it in percent in progress bar
Open VR Pawn, viewport,
add Widget in component called HUDWidget, root under Camera
change its widget class to HUD in details
set draw size to 1920x1080, adjust the transform. change the material to HUD mtl:
Collision prest change to NoCollision (player shouldn’t be able to interact on hud bar)
Drag the VR pawn in scene and see in camera view if the bar in good position: delete the pawn after testing
Go to VR Pawn event graph, plug out input action trigger left right,
Add varialble as Health, health value as 100:
Create follow nodes (Clamp max and divide should be 100, not 1 and 0):
Duplicate the nodes to trigger right, but change - to + after get health
copy 4 nodes from there to connect to event to begin play node, and add extra as follow, change set health percentage from 0 to 1 (let game beings with full health bar):