How do I trigger a blueprint's function from C++?

I have a blueprint function SaySomething(FString Speech) which, when triggered, displays Speech’s text in a randomly selected text block from my UI, then hides it after a few seconds:

Where I’m getting stuck is executing the function- is there a way I can call SaySomething from one of my C++ modules, instead of using it in blueprint?

If you use BlueprintImplementableEvent you can call the function in C++ and define the body of the function in blueprint. By defining the function like this in C++…You’ll be able to add the event node for it in blueprint.

UFUNCTION(Category = "Whatevs", BlueprintImplementableEvent)
void SaySomethingEvent(FName Speech);

Ooh, thank you! Just one follow-up: I’ve been looking over the example in A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums after looking up BlueprintImplementableEvent, and how does he actually get the event (red node, Player Health in the tutorial, SaySomethingEvent in your example)? I pasted your example verbatim into a module, compiled it successfully, then opened a blueprint, but even with context turned off, I can’t see the SaySomethingEvent node as a suggestion.

Should be under Add Event. Are you trying to add the node in a child blueprint or from another blueprint?

I found it in Call Function, but it expects a white Execution line going in, so I assume that’s not it. The code declaring it is in a ActorComponent that every character who can talk has, and the blueprint I’m trying to hook the function to is a UMG UserWidget, an instance of which gets created on every character at runtime.

Hmmm - I’ve got all my events as virtual functions in C++ - Example:

UFUNCTION(BlueprintImplementableEvent, Category = Action, meta = (DisplayName = "StartEffects"))
	virtual void BP_StartEffects(EEffectTypes effectType);

My blueprint callable functions are not:

UFUNCTION(BlueprintCallable, Category = Action)
	void Clicked();

Events you have called from your C++ should show up as red event boxes when brought into the blueprint. If they are not there, possibly the hot reload did not update your editor. Close the editor and reopen to see. In fact, on the mac, you always have to do this to get events to show up in the selection box of the blueprint. As THREEONZERO said, be sure you are attempting to find the event in a blueprint derived from your C++ class.

I’m a moron, I was expecting a blueprint not derived from the C++ class to still see it- reorganizing things a bit fixed it perfectly, thank you so much! :slight_smile: