Pass Variable from HUD Blueprint to Level Blueprint

Hello.

I have a very simple scene and functionality setup that I want to do. Basically just to be able to hide, un-hide some meshes during the game with the help of some buttons that will always be visible to the player.

I managed to get the buttons to change its texture depending on BOOL Button Pressed true or false.This is done in MyHUDBlueprint.

But I just cant seam to find a way to pass that variable Button Pressed from MyHUDBlueprint to the LevelBlueprint in order to make the button do something in the scene. Like hide, un-hide the mesh.

Can you guys please help ? I feel like its something minor but I cant point my finger yet on what I am doing wrong.

Thank You

It helped and then some !

It turned out It was, as I suspected, much simpler than I expected.

THANK YOU VERY MUCH !!!

Hi Diablo,

I’m sure there are a number of ways you could do this, one way would be to use a [Blueprint Interface][1].

Create a HUD Interface Blueprint with a Bool Out Node. In your HUD Blueprint, implement the interface through the Blueprint Props. In the interface section of your HUD Blueprint, connect your Button Pressed variable to the out pin of the Return Node.

Now in your Level Blueprint, you can then read the value of that Bool how ever you want (with a quick example below that just returns the value from the HUD Blueprint when I overlap a trigger box).

Hope this helps!

-W

How would you use that same interface setup to trigger an event instead?
Or do you just set up your tick function in the level blueprint to constantly check the value of that bool?

Nevermind, I figured out a much cleaner way to do it for my needs using an event dispatcher instead :slight_smile:

I wish people who “figured it out” would explain their solution and not just say that. I’m using an event dispatcher but it’s a fail… Oh wait!

3 Likes