Rendering order (HUD)

Hello

i have a simple FPS game and i’m kinda stuck with the HUD.

i have the player controller BP which sets all the different variables (Health, Ammo etc.).

when i launch the game, the HUD won’t update until i do something (walk, fire etc.).

i have a function which updates the HUD in the player controller class and i call it whenever i need to update the HUD

i need to somehow call the “UpdateHUD” function before the HUD is being rendered.

thanks

All you have to do is call the UpdateHUD function right before you add it to the viewport. You can also spawn the HUD in the controller’s Begin Play Event and call the UpdateHUD function right after.

im sorry, i didn’t quite catch that.
what do you mean by “call the UpdateHUD function right before you add it to the viewport”? how do i do that?
and where does the HUD initially spawns? i don’t see anything in the player controller.
( i am currently working on the first person template from UE tutorial projects)

Oh I see your problem here. You have a default HUD class and I’m assuming its parent class is HUD? You may want to switch to UMG. Anyways, you should be able to call the ‘Event Begin Play’ for your HUD class and then just call the UpdateHUD function from there. If you need a reference to the player controller to call your function just use Get Player Controller to retrieve it.