Hello there- I am new to UE4 and using blueprints. I have watched the introduction tutorial videos about Blueprints, and now I have a question: Can I nest blueprints within each other?
Example: I have one blueprint consisting of a handful of mesh parts, that combine to make a modular segment of a wall. I would then like to have a 2nd blueprint in which I can place several instances of the first blueprint, to construct a full room.
Is this possible?
You can sub-class off of blueprints. Either in C++ or in the blueprints.
Thank you for your response, unfortunately I don’t know C++, and I don’t know what it means to ‘sub-class off’ a blueprint.
However I did basically complete my objective by doing the following:
- Place blueprint 1 into my level
- Place blueprint 2 into my level
- Select Both
- On the bottom of the details pane, in the Blueprint category, click "Replace with Composited Blueprint. The 2 blueprints are now inserted into a 3rd blueprint, which you can name.
This is basically what I wanted to accomplish, however it doesn’t seem optimal, because I still can’t add new sub-blueprints to this composite without nesting them another level deeper.
Hello Mr. Keene, coming in late, but am seeking to nest one BP inside another, greatly appreciate a tip how to ‘sub-class off’ a BP. Thanks.
When you create a blueprint it asks for what other blueprint to use as the parent. That is often an Actor, or another “common class”. But you can pick any blueprint as a parent.
So a blueprint “is a” whatever its parent class is, and than adds to that.
So if the parent blueprint is a Vehicle, then the blueprint may be a Car.
The Vehicle has MaxSpeed, NumberOfWheels, GasTankSize.
The Car then might add the TurnRadius is 10 meters. etc.
So a Car “IS A” Vehicle.
In Unreal Engine, maybe your Soldier blueprint’s parent is an Character.
So the Soldier IS A Character, and the Character IS A Actor and Actor IS A Object.
Object is the base class or parnet of ALL blueprints.
In effect the parent blueprint is nested inside the child blueprint.
Variables in a blueprint are a HAS A relationship. A Vehicle HAS A NumberOfSeats.
A Soldier HAS A HitPoints.
IS A is called inheritance.
HAS A is called Agregation.
In both blueprints and C++ classes there is inheritance.
A blueprint is a template for an actual instance of the blueprint.
So Soldier might be the blueprint or template or cookie cutter, and ChuckNorris is an actual specific instance of a Soldier (the cookie). When you add a blueprint to a map or scene in your game you are using the blueprint to create an actual instance.
Yes, you can do it by adding a Child Actor Component to your blueprint and in the Details panel for it setting the Child Actor Class property to the desired child blueprint you want.
I tried this and it worked perfectly for me. If you wand composition of blueprints, this is the answer.
I feel like this answer is off target. The question is about using blueprints within other blueprints, so the solution is clearly agregation. The example given here is for inheritance, which will take OP down the wrong path.
don’t use subclassing, that’s something else. The top answer “adding a Child Actor Component” is the way to insert one blueprint into another.