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.
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.
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.