Why is my child blueprint not inheriting parent functions?

First post here, sorry if I don’t have the right question categories.

I’m following a tutorial on implementing a weapon system into a project. Each weapon is a child of a base weapon actor class, which is a child of a base item actor class. So far the item class has two custom functions I wish the weapon class to inherit and override, but they don’t appear in the child nor in the function override drop-down menu.

The tutorial comes from UE4, however, so that may be why. I’m sure there’s just a box I’ve forgotten to tick or untick, so I’m sorry if this is a very easy solution, but maybe that’s a good thing.

Timestamped the problem in question.

hi,
is your base item class marked as abstract class ?

cheers :vulcan_salute:

It is; the previous video in the tutorial mentioned this is to prevent it being spawned in any scene.

  • Ensure that they are in fact children of the parent class

  • ensure that the functions are not Private (need to be public or protected)

make sure both classes have been recompiled

1 Like

The functions were private. This must’ve changed between UE4 and 5.1.
That’s my mistake for following an old tutorial to the letter, I guess. :sweat_smile:

1 Like

what was the mistake? Share it in case somebody else searches in future, they can get an easy answer

2 Likes

How would you go about doing that?

when you have a function selected, check the details panel for the access specifier dropdown menu. Looks like this:

What about functions created in a blueprint interface? They don’t have ‘access specifier’.

they are public by definition. anybody can call an interface, so all functions are public.

you can think of public / private as if the class is like a radio. Public would be the buttons that other things can see and manipulate. But the radio may have stuff that it needs to do on the inside that others dont need to know about - that would be private functions.

So like if you walk up to a radio and it has 50,000 buttons, you’ll have no idea what to do with it. But if you look at it and it just have 10 buttons and they have names like “volume knob”, “power off”, then you understand what can be done with the thing.

so access specifiers is just a way to organize access. its more important in a team environment.

since the purpose of an interface is just to give a common way for disparate classes to act upon the same functions/events, it is by definition public.

Thanks for that. But the child blueprint doesn’t get the interface function’s functionality from the parent. As in, the function that’s created in the blueprint interface and then called, and worked on, in the parent, doesn’t pass it’s functionality to the child blueprint: the function’s graph is empty except for the 2 default nodes.
Do you know what that’s about?

If you have a parent class that has implementation on an interface function / event, in order for a child class to to get that same functionality, you have to call the Parent Function.

I don’t have a specific example ready in my open project, but if you just right click a function or event there is an option to Call Parent function. For instance on the tick event here:
image

To test if my memory is correct, you can put a print string on some interface event and have it just print the Self name. In a child class, make sure the parent function/event is called and then you should see that instances name print when the interface function/event is triggered.

1 Like

Thanks.
But I’m confused as to what the point of a child blueprint is, since you have to go in and add your desired functionality anyway, albeit just a simple node. What’s the point of not getting the whole logic from the parent?

I probably can’t give the most complete answer, but there is a few things I can say:

  • variables, functions, and events all carry-over. so you might have a bunch of functionality in the parent class that intakes some instance editable variables and performs logic on them. But in the child class which your designers deal with, you dont want them to see all the inner workings, so you just expose the variables for them to populate but the code is privately tucked away in the parent.

  • if you do not override a function or event in the child class, the parents functionality is performed, for example if you have a print string on begin play in parent class, a child will run that unless you implement the begin play event in child and don’t call the parent.

  • this is just how pure blueprint classes work. if you look into c++, there is a lot more functionality for how to control access, but I dont know it well enough to explain. But you have ways to be very specific like if you want an error message to display if an event that is meant to be child implemented is not.

  • i think in editor preferences you can set it so that call to parent function always appears by default

Some real programmers might be able to give a better answer