How to Cast to HUD from an Actor

For example, I am trying to change the image properties of an element on my HUD whenever I take damage. However, I don’t know what to put for the object wild card, when casting to HUD inside of an actor. Normally when you cast to ThirdPersonCharacter, your object wild card is GetPlayerCharacter, however for the HUD I don’t know what to put there and it will keep giving me errors. Below is a screenshot of my KillBox that I used for debugging purposes and testing this out. Intend on making this as a potential event dispatcher or function once I get it working right.

This is where I can be a bit rusty myself, but I believe you typically wouldn’t cast to your visual HUD if its a Widget. You would just use the variable that points to the widget creation node and utilize that variable to gain access.

If you wanting to communicate to the Default HUD controller, you can use the Get HUD node from the player controller to grab a reference to it.

This is my character blueprint here - in the first image, you can see I create the visual HUD Widget right away and then set it to a variable. This makes it possible so that whenever I need access to it from any other blueprint, I just cast to the character BP and grab that variable. Pretty much same deal with the controller, except its a cast node instead of a widget creation node.

Hopefully this makes sense and is what you are looking for…

K

1 Like

Ahh, yes, that’s right, I just realized that myself. I totally forgot about the HUD Variable I made in the ThirdPersonCharacter. Hahah.