How do I reference the character in my HUD blueprint in multiplayer?

Thanks in advance for any help here. I am looking for the best way to reference my character from my HUD blueprint, I have a working example but it doesn’t seem like the right way to do it. This only causes an issue for the Client but the Server works.

This doesn’t work but it seems like the right way to do it.

This does work but I try to avoid Event Tick where possible.

Thanks a lot, that all makes sense but I don’t see EventReceiveDrawHud. The parent Class to my HUD blueprint is User Widget. Sorry, this is my first project.

I just realized the confusion, by HUD I do not mean the HUD Class that you reference in the gamemode. This guide has got my terminology all mixed up

oh, i thought it was a HUD blueprint. i would recommend giving your HUD blueprint a reference to your character, and let the HUD spawn this widget, and the HUD can feed this widget the information it needs to render, copying values into the widget, like health or ammo, without the widget having a reference to the character. because you might want the widget to continue to display information after the character has died.

if the character dies and goes null, the HUD would start checking for a new character reference, and it would stop updating the widget, while the widget would just continue to display the last values that were copied into it.

i usually give the HUD references to all important actors, and spawn all widgets from the HUD, controlling the widgets like puppets, while the widgets just display whatever the HUD tells it to.

You’ve been a great help. I will look at adding a proper blueprint which inherits the HUD Class (by clicking the + button in the GameState). From that I will create/add the User Widgets rather than via the Character.

Thanks again

I was having this exact problem, turns out it is related to the order in which controllers get instantiated. See this thread for a solution: