I am trying to understand why I can’t invoke a custom event set in one blueprint from another.
Following different tutorials. it should be as easy as
- create custom event in blueprint 1
- invoke custom event in blueprint 2
all easily available from the context menu, however; I don’t get my custom events showing up in blue print two that I can see.
To help understand why, I opened up the content samples from UE and loaded the Blueprint_Communication example.
Opened BP_Light_Bulb_Basic blueprint and reviewed the event graph. There I see two references to ‘Toggle Light’
But if I delete these references from this event graph and wanted to recreate them, I can see no way of doing this from the interface.
How is this done, what am I missing?
Have you tried a cast node?
In blueprint 2 cast to blueprint 1, you should then be able to drag off the cast node and call the custom event.
Another way is to make blueprint 2 a child of blueprint 1.
It depends what you are trying to achieve.
In the first instance, how to replicate the event call as seen in the UE example. I don’t understand how to create the event call nodes as seen in the attached.
Just right click in blueprint space and type “custom event” then rename that custom event to what ever you need. =D
You can also create a new function if you need to and call that via a cast node as well.
I tend to created new functions instead of events if I do not need to use blueprint nodes which deal with time, such as timers as they only work in the event graph.
I’ve no trouble creating the custom event, it’s calling it from the other blueprint.
In the attached are my two (basic) Blueprints. I want too, but cannot figure out how to call the event from the bottom blueprint called MakeH
Ah right I understand, firstly you need a variable node so are you able to cast it off. How you get that variable is largely dependent on your gameplay.
For example, say you want to call MakeH after you have clicked on the blueprint in game.
You would add a “rock” variable in your SM statue blueprint, then assign the sm_rock_c to that variable.
Then “get” the rock variable in blueprint space, drag off it and type “cast to” then find “cast to sm_rock”. Then drag off the output actor from the cast node and you should be able to call the event there.
Again, I dont know how your game is working, but hopefully this helps.
The “rock” variable in your statue Bp can be of type “sm_rock” or even just “actor”.
If it is only an actor, you will need to cast to sm_rock, if the type is sm_rock you should be able to drag straight off it and call the custom event.
I found that by using 4.9’s “Construct Object from Class” node, you can then trigger a Custom Event defined in that class, if you don’t have any instances of that class already present (particularly for things that aren’t Actors in the scene). See: http://jevon.org/wiki/Saving_and_Loading_UE4_Data_with_Blueprints
For example, triggering “Save The Game!” event within a “SaveGameBlueprint” external blueprint from a “FirstPersonCharacter” blueprint: