I would like to call a custom event in my level blueprint from my HUD blueprint, is this possible
There no way to get level blueprint from blueprint only via C++ by extending ALevelScriptActor and adding events and binded functions
You could try to call HUD from level blueprint
What Object would i use to call HUD with
One way to do this would be to create a new variable in the level blueprint and set the variable type to the HUD object reference.
What would i attach to the cast to node at the beginning
Nothing. Since you can call the HUD through the variable like this:
First create a new variable inside the level blueprint and name it preferably the same as your HUD.
Secondly, in the details panel change the variable type to point to your object which is your HUD (below is an image example).
And now you can drag this variable inside the level blueprint as a get -node. Now you can call any variable or function you’ve made in your hud inside the level blueprint. As the below image shows I have an refresh inventory function inside my Character_INFO HUD and I am calling it into the level blueprint now.
How would i do this in reverse, so i can call the Level’s Event from the HUD
I don’t think you can do that. May I ask you what are you aiming to do with your project so that I could be more of help?
I am trying to trigger a matinee from my playerHUD when a button is pressed
Sorry for taking so long to come back here and comment on your question… Couldn’t get to computer in a while.
Did you get it figured out? If not then I might be clueless as in what to do aswell. I haven’t worked with matinees ever before so I am not exactly sure how it works but couldn’t you do it so that you drag off a pin from the button that is pressed and call a Play function in. And then you just connect the matinee actor to the play function?
I have found a way around it thanks
This is definitely possible and quite easy. In your HUD, create a new event dispatcher (name it “cool_event”). Now, in your HUD’s event graph from your button’s on clicked create a “call cool_event” node. Now in your level blueprint, simply get a reference to your HUD, drag out from it and add a “Bind to cool_event”. Off of the Red Event Pin on the Bind, drag out and call “Custom Event”. You will want to initialize the BIND at the start of your project. Then the custom event is enabled and any click thereafter on your button will fire from the custom event. Its only a little convoluted, but it will work just fine and once you get the hang of it (or the idea behind it) its very easy.