I have a parent blueprint which sets up the static meshes with a certain material in the construction script and adds an event listener on begin play.
Now I have several levels, and in each level there is a blueprint which uses the parent blueprint as its parent. It is mandatory that each child blueprint executes the steps described above, i.e. that it calls the parent construction script and the parent begin play event. Rather than having to call these methods manually for every child, I want to force the children to call the parent methods, no matter what. How would I achieve this?
The children donât need to expose the parent calling to anyone btw., but if they do Iâm fine with it, as long as I donât have to set it up manually everytime and as long as the children canât just delete the call to the parents.
this âright click â select âCall Parent Methodââ is what I mean by manually. and yes, I want the child node to have the parentâs event node present from the start. other people may add new children over which i donât have any control, but these children need to execute the steps from the parent, otherwise the application wonât work properly
What do you mean manually versus automatically? Iâm picturing right-clicking the event in the child bluprint and selecting the âCall Parent Methodâ option (I think thatâs what itâs called) which gives you an orange function node that calls the parent classâ method. If thatâs what you mean by âmanuallyâ, I donât know any other way to do it, but Iâm probably the wrong person to ask since I havenât used inheritance beyond creating classes from the built-in classes.
So what I do is I let the child classâ event call the parent classâ event function. Are you saying you want the child class to not have to do that and just HAVE the parent event node already there and start from that? I donât know how to do that.
I have looked arround a bit, but I couldnât find an âOverridden functions listâ. Is this callable from the parent? And even if so, how would you go about it?
I mean in the left sidebar of the blueprint editor window thereâs a list of functions that youâve defined, and at the top of that pane, it says x number of functions, y number overridden. If you click that spot it drops down with a list of inherited functions you can override. I wonder if the events you need to override are in there?
Oh, right, sorry. Still new to this.
It says âOverridableâ though, so it doesnât say which of its functions are actually overriden. So far I havenât found the option that makes a function non-overridable, but I donât know about all of the tools I have.
Itâs simple
Instead of creating the new child through the parent, create the new child by copying another child. I leave a child that I call âbase_childâ just for this. It did not have any changes in relation to the parent, but I make sure that all calls to the parentâs methods are set. So every time I want to create a new child I make a copy of the âbase_childâ instead of creating it from the parent.