Download

Can I use blueprints within blueprints?

Hi,

I want to combine blueprints but somehow it doesnt work.

Lets say I have a blueprint that consists of some meshes, making a switch with a moving lever and keypress events.
Then I have an elevatoer blueprint, consisting of some meshes, making the levator shaft and the moving platform.

I wanted to add the switch blueprint now to the elevator blueprint just like a normal component. But this doesnt work.
I cant drag blueprints into the components panel…

So, how can I combine blueprints?
(The reason why I dont want to include the switch mechanism in the elevator blueprint is: I want to reuse the switch for different kinds of elevators)

Cheers,
Klaus

Hello,
if you want to combine blueprints, add them in viewport editor, select them and down of details,j under scene outliner, on the right of the screen : replace with composited blueprint. Then you can have your switch blueprint and your blueprint withswitch and what you want with.
If you don’t want to merge them, you’ll have to use cast / interface / event dispatcher to communicate. (or give a try to attach actor to actor, store the attached in a variable and use it to communicate)

Hi,

Thanks for the fast reply :slight_smile:

I planned on doing the communication via references. I dont know if its possible like that…

The elevators have a public event that, if triggered, moves the elevator.
The switch blueprint has a variable for a blueprint and triggers that referenced blueprints event…

elevator blueprint:

  • OnCustomEvent : movement and stuff

switch blueprint

  • Reference variable.
  • OnTrigger: Call Reference.CustomEvent

So the logic distributes as following: The elevator only moves when its told to. The switch triggers an event of a referenced blueprint.
What the refernces vblueprint does is of no concern foer the switch.
That way I could use it also to turn lights on and off. just referencing a light blueprint instead of an elevator and the CustomEvent of the light would turn it on or of instead of moving things…

Can anyone give me some pointers ionto the right directioon here :slight_smile:
Im just starting with blueprints…

Cheers,
Klaus

Hey Klaus,

you should really look into Blueprint Interfaces -> Documentation or Documentation

You could define an interface with a function called “Button_Pressed” or something like that. Then your elevator can implement that interface and use the “Button_Pressed” function and do whatever the elevator should do. At the button blueprint you just have to call the interface function.

I hope I could help you!

Cheers,
Christian

Hi,

Christian, thanks for the documentation links. Now I have something to read :slight_smile:
The way you describe is is exactly how I imagined it.

Cheers,
Klaus