Calling a parent event with blueprint

How does one access parent functions with blueprint?
I see an example of a child calling a parent’s event in the content examples. Specifically the BP_Pickup_Child_Cupcake blueprint, but I can find no way to call parent events with my own blueprints.

Hey Vaporlynx,

If you want to call parent functions/events from your child blueprint, you can do the following:

  • If you want to call an Event from the parent–for example, Begin Play–add the same event to your child’s event graph then right-click on the node and select Add call to parent function.
  • If you need to call a function from the parent, you can just right-click in your eventgraph, search for the function name, and select it from the search list.
  • If you need to Implement that function (basically, override the functionality) you can select the function from your My Blueprint tab and right-click on in to Implement it in your child blueprint and add your altered script in it.

There is a limitation to this and it is that you cannot call events bound to components in the parent blueprint. See the following thread for an explanation: Overriding parent events in child BP class - Blueprint - Epic Developer Community Forums

Hope that helps you out!

23 Likes

Thank you, that was it exactly.

+1 for “Add call to parent function”! I didn’t know that node existed :slight_smile:

1 Like

Something I just noticed: in 4.9 if you have class C with parent B with parent A, class C can’t call a parent event unless B calls a parent event.

edit: looks more complicated than that - I ran into it on a larger project and haven’t gotten a simple example to fail. Also seen here: https://answers.unrealengine.com/questions/296211/trash-class-bug-when-updating-from-48-to-49.html

That’s lame…pretty much the ONLY events I wanted to go to child were the ones that are specific to a component…like “on capsule touched” to create the targeting system. Or the “on sense Pawn”

my on touched is easy enough to copy and paste…i’m gonna presume there is a way to actually make a BP that can be called for A.I. and that i dont have to create it inside every single monster that uses the “run up and attack” system… (not that it’s super hard but as I add in dodges, or fleeing I dont want to deal with the whole things inside each BP

Hello, did you manage to figure out how to do it with events instead of functions? I pretty much have some code that should run as normal for every child class, so I want to add it to the parent class, but then I want it to call an event after that, I want to be able to change this code for the child classes

Typically for something like this - the better process flow is to build 2 functions. One a function and one an event that is called by the function version.

For example, I have “StartRound()” as a function and “OnRoundStart()” as an event. When I need to trigger the start of the round, I callled RoundStart() which does all the necessary work to get the round ready (incrementing the count, cleaning up old data, getting the map staged) and then when it’s finished, it then calls OnRoundStart() which then triggers as an Event for any child-blueprint to override without fear of breaking the core functionality (kept inside the function).

If you’re designing this in C++ it would be basically
UFUNCTION(BlueprintCallable)
virtual void StartRound()
{
//Do stuff here for native implementation
BP_OnRoundstart()
}

UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName=“OnRoundStart”))
void BP_OnRoundstart();