Blueprints: Call Parent function from child for overwritten function.

I know how I can overwrite a function in a child Blueprint. I also understand how I can call a parent function from within a child blueprint. But once I have overwritten a parent function by choosing “implement function” in the child blueprint I can no longer call the parent function from within the child blueprint. When I right click and search for the function I get two names in stead of one but they both seem to refer to the overwritten child function and not the parent function. When I search for a name of parent function that is not overwritten in the child blueprint I get one result and I can call the parent function.

I also have an ther question: I don’t understand how I can overwrite a interface function. I can implement a interface function (from a interface blueprint) with an event. But how do overwrite the function like in the UE4 documentation:

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Types/Interface/UsingInterfaces/index.html#overridinganinterfacefunction

I asked your first question a while ago on the answerhub https://answers.unrealengine.com/questions/18160/using-super-in-blueprint.html
as for the second question, i don’t have ue4 available right now, but i’ll give it a look when i can.

To call a parent function from a child Blueprint, right-click on the function entry node and select “Add Call To Parent Function”.

25 Likes

Thanks this works!

So simple… I was stuck on this too, thanks for the answer!

Thanks, Tom! There should be an easier & alternate way to do this, like rmb-ing the actual graph and being able to search for that event/function and have something similar to “add parent OnPostLogin”.

Anyway, for those whom like visual aids, this is the current way to do it:
Unreal_AddCallToParentFunction_FromChildBlueprint_01.jpg

7 Likes

In previous versions of the engine, the call to the parent function was automatic. Not sure why they removed it, but I guess there was a reason.

To answer both of the OP’s questions, though, since google brought me here and I like to be thorough:

Descriptions of the code under each image:


Here I’ve created a Blueprint Interface, and I’ve created two functions. One with an Input and an Output, and one Without either.


Once you add the BPI to your blueprint, you’ll see an “Interfaces” category appear in the My Blueprint panel. For any function without an Output, you can Implement the function by right-clicking on it in this list and choosing Implement Function.


Any Function WITH an Output will not work this way. You’ll only get the option to open the graph but not implement it. To Implement it, you need to right-click in the Event Graph and choose Call Function on the function you want.


Function with Input and Output Called.


For a Parent Actor, you can create custom events, or run something on Begin Play, for example. You can also create variables like this Bool.


Once you’ve re-parented your actor or you create a child, you’ll get access to the parent’s code. To access the code, you have a few options. You can Add Event - thus overriding the even in the original parent, or you can Call Function on the event and simply call it rather than overriding it.


Example of both Overriding an event (red) or calling it (blue).


If you want to call the parent’s Begin Play code in the child, you’ll need to create a Begin Play node, and then right-click on it and choose “Add call to parent function” from the list as Tom_Sarkanen mentioned.


Then once you’ve connected the Parent: BeginPlay node to the child’s BeginPlay, it will run the code implemented in the parent first, before then running the code in the child.

I didn’t take a screen shot of this, but If you want to access the parent’s variables, you’ll find them in the right click menu too just as you would search for any other variable in the child. I just discovered that categories don’t come over to the children though which is odd, but at least it works to call them by name.

For C# folks googling the BP equivalent to:

public override void Method()
{
base.Method();
}
image