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.
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.
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 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.