Download

Blueprint nesting.

Just a quick question. I was thinking about how nested blueprints could greatly increase customization. But when I tried. The ‘ChildActor’ blueprint doesn’t give me access to all of it’s public variables. Has anyone else messed with this?

The reason that the child actor will not let you access it’s variables is that the child actor is dynamic (and is of type ‘Actor’), kind of like how you can’t access your character’s variables by using ‘Get Player Character’. You should be able to cast using the child actor if you know what class to cast to.

Components have now taken over a lot of the functionality of child actor blueprints for me since you can get the same functionality of nesting but have the ability to change the attributes per object easier.

I noticed that the casting worked, But I would like to be able to edit the variables on the components within the blueprint to make presets. I guess there just isn’t a way beyond doing it at begin play, huh? Bummer if that is the case.

I tend to use getter and setter functions. It works fine.

I see what you’re saying, I would use a public variable on the parent blueprint to set the variable on the child. Correct?

By child actor do you mean a child BP of some other BP you’ve made? If so, Child BPs inherit whatever variables you put on the Parent/Master BP, you just have to click on the eyeball/drop down menu above the variables menu (sorry forgot exactly where it was) and select show inherited variables (or whatever the show inherited option is).

You are correct, I have a blueprint that is a child of another blueprint. I want to access the public variables on the child blueprint. Your suggestion is interesting, though not what I am looking for.

I’m confused now…Are you extending an existing blueprint (inheritance) or are you adding an actor to your blueprint (composition)?

OH, you want to access the variables of a child actor inside the BP itself. Yeah I’m not sure how you would do that beyond casting to the corresponding BP.

Sorry for the confusion, Let me try to explain better.

I have BP-B nested inside of BP-A as a ChildActor. BP-B has public variables that need to be changed while they are being placed around maps. My question is: Is there a simple way to access the public variables inside of BP-B(The ChildActor) from BP-A?

Seems like there should be a better way to access a child blueprint than casting. If the parent BP could inherit the variables of the child BP. That would be an ideal situation in my humble opinion.

Is that anymore clear?

Right, but parents don’t inherit any traits from their children, that would make Natural Selection work in reverse. Your parents have inherited none of your physical or emotional attributes. You inherited those from your parents.

While a nice idea, it would pretty much negate the purpose of even having a “parent” and “child” blueprint if they could both inherit from each other. There would really not be much of a purpose to it.

The only way I know of to do what you want is through casting.

However, one thing you could try (depending on what functionality the child actor is supposed to have) is on BeginPlay you could cast to BP-B and promote it to a variable (of BP-B) and then just reference that variable whenever you want to set something for the child actor.

This method, however, means that (I think) the variable won’t actually be the child actor component that is in the component tab of BP-A, but it’s own thing. So if whatever you are using the child actor for can be done through the variable rather than on the child actor itself, this method could be of use. If you need to set variables on the child actor component itself this method will not work.

For reference, I previously used this method (though it is no longer needed) to set a variable on my character based on a BP. I didn’t want to place the BP in the world, however, so to reference it I added it as a child component on my character, and then used that to cast to the corresponding BP and set the variable on the character that way. Not the prettiest method, but it worked.

But good parents do correct the behavior of their children.

Thanks for all the input everyone. I am just going to use the casting.

Why would you need a parent to cast to one of its children? What situation are we looking at?

It is all done and working perfectly now with casting. But I need to be able to edit the size and scale of some of the pieces on BP-B from the editor since they require different things at different areas of the level. But I also need them to be in different configurations, and ease of use for spreading around. Hence needing a parent BP(BP-A)

What I did was create mirrored variables inside of BP-A and use those to set the corresponding variables in BP-B. So I can set my variables from the details panel.