How can my class blueprints communicate with my HUD?

I’ve been reading through documentation for a week now and have decided that I am missing some crucial piece of the puzzle, I’ve tried watching several tutorials and somehow I’ve yet to get what should be a simple thing to work: I am trying to pass the state of a bool from a blueprint made from an object, to my HUD.

In short, when the player touches the packet of drugs; the name of that drug should appear in the top left corner of the HUD. I’ve tested the HUD blueprint by just turning the Variable for one of the labels to ‘TRUE’ and it works, so I know that the problem has to be with the communication between the blueprints.

I know I’m missing a target in the class blueprint, I’ve tried several things but nothing has worked, so what do I need to assign as the target to get it to communicate with the HUD blueprint?

I’ve also tried setting a bool in the interface and getting the class blueprint to update that bool to true, which I can then compare in the HUD blueprint, and that doesn’t work either. In short I’m totally stuck here.

I’ve also tried casting, to the HUD as shown below, but I have no idea what nodes to use in the HUD blueprint to get casting to work.

I’d really appreciate some help here, firstly with what I’m doing wrong, but also with understanding how these interactions work, because I clearly don’t!

I’m looking into your problem. First of all, you didn’t forget to set your HUD as HUD_2 in the GameMode, right?

No I didn’t forget to change my gametype, however I have just solved my problem. I’ve gone back to the interface and it looks like I already had all the code I needed, I just hadn’t joined it up into one system.

It looks like I still needed to specify my HUD as a target for the message for the interface, despite my interface already being referenced in the HUD and the class blueprints. Basically, in the class blueprint I have:

My Interface blueprint is a basic interface function with no variables in it, and in my HUD I have an event for the interface function that now fires properly.

Thanks for your help alperenakyuz, I really appreciate it! :slight_smile:

As an observation to the developers:
I did try finding a node to represent my HUD by dragging off the target pin of the ‘interface message’ node. This however didn’t show anything. I COULD find it by dragging off the ‘get player controller’ node and then connecting it to the interface message, both of which give me the same result, so why can’t I see the ‘get HUD’ node when I drag off the message target pin?

here is an example to make this easy:

here is an example i used in my game,
if i want to call a function on the dialog hud i just did this

48781-naamloos1.png

so when u create the hud set a variable
(to get the correct variable type just drag out the return value node and press promote to variable)
than can you do the same as i did above just get the variable drug interface(in ur case) and tada.

if you draw the hud from the level blueprint then you need to do that in the character, just make an node “begin play” and connect the part that creates the hud there

sorry if my english is bad
i hope i helped