Communication between Player and HUD Blueprints?

Hello,

I have got some informations about the Player in my Player Blueprint like for example Health and want to take that Information and update it into my Hud, so My HudHealth bar always shows the current Health of the Player.
But I am not able to communicate between the Player and Hud blueprints. When I create Object References from the Player class to the Hudclass I “seem” to have access to all variables, events and functions in the HUD blueprint. But The information I want to give the Hud never reaches the hud. When I am in Debug mode I can see that none of my Calls to it are working.

This For example is a Part where I wanted to test it. So I wanted to Set the health to a value of 50.

http://s14.directupload.net/images/140323/nfnbw87l.jpg

This is now in the HUD blueprint where it should affect the local Variable.

http://s7.directupload.net/images/140323/rjw8lzs3.jpg

But since it never reaches the Hud I guess there is something wrong and I should set the correct Reference.

http://s1.directupload.net/images/140323/bc5z6kvz.jpg

But as you can see I can’t add the Hud File in there and I have tried a lot but I am always stuck.

I don’t have got any Idea how I can make this work and I really need your help to slap me in the face and tell me what I should do and how it is done.
I already have seen Tutorials about it and read stuff on the Wiki but nothing helped me or wasn’t working.
For Example the https://www.youtube.com/watch?v=s5pIrpI7py8 Tutorial
Isn’t helping me because I can’t just select the Blueprints and add them into the Blueprints and I am really out of ideas.

Greetings

Get Player Controller -> Get HUD = current active hud object.

Hello,

The reference you are trying to make is to the HUD class you created, but doesn’t reference the instance that is actually in use when you’re playing in your level. I’m assuming you’ve already created a new Game Mode blueprint that references your HUD and that Game Mode is set in your Level’s World Settings–from there, this is how you would reference your HUD and call your function:

This calls the Player Controller which can access the HUD in use by the Level and uses the Cast to function to cast it to the HUD class you created (in my example, I named it MyHUD) so you can access the custom variables and functions you added to the HUD.

You may find a more thorough example in the Content Examples download from the Marketplace, specifically within the Blueprint_HUD map.

2 Likes

THANK YOU!

Thats exactly what I was looking for and now it works perfectly. And thanks for the information, made it a lot clearer to me what my mistake was.

You’re the man dude! Thanks a lot, this helped me figure it out.

is anyone able to grab the hud from player controller in 4.5.1? this seems to be disconnected or something.

Thank you. I was cured of a severe pain with this.:slight_smile:

THANK YOU SO MUCH! So simple, yet you solved an issue I’ve been stuck on for a few days XD