Linking multiple buttons to unlock one door

I’m currently learning UE5 and I was wondering how to approach linking multiple buttons to unlock one door. I saw a forum on here posted about 4 years that talks about it but I don’t quite understand it.

Hi, welcome to the community!

Are you referring to 3D buttons that are in the level, or UI buttons?

I would assume it’s 3D buttons, so Actors that are in the level.

Here’s what I would suggest:

1- Right click in the Content Browser then Blueprints > Blueprint Interface. This would create an empty Blueprint Interface. Let’s refer to it as a BPI.

2- Rename the BPI, for example BPI_Doors then open it. It will have a default function called NewFunction_0, rename it to OpenDoor.

3- Create a BP_Door actor and open it, this is the Actor Blueprint of the in-world door that has the door mesh.

4- Go to the Class Settings of the BP_Door actor found at the top bar, then from the Details Panel navigate to the Interface section, click Add, then select BPI_Doors.
Now the door actor can utilize the doors BPI.

5- from the My Blueprint panel, double click the Open Door function, this will add a new Event to the graph, this is where your door opening logic should be.

6- Create a BP_Button actor and open it. This is the actor responsible for opening the doors.

7- Create a new variable of Actor type and call it DoorReference, make sure Instance Editable and Expose On Spawn are set to True.

8- Create a new custom event and call it OpenDoor for example, this is the event that your player should call when interacting with BP_Button actors.

9- Get a reference to the DoorReference variable, check if is valid, then check if it implements the BPI_Doors interface. If it does implement it, call the OpenDoor interface event.

10- Now you can drag and drop as many doors and buttons as you need to the level. When selecting any BP_Button actor, you will be able to pick or select which door actor it opens from its Details Panel.

This is of course just a general overview to help you get started. I hope it helps!

2 Likes

Hey there @Rissa818! Welcome to the community! The answer would come down to how you want those buttons to change the door’s state. If your use case requires all buttons to be pressed before the door opens, you could just set a Boolean variable for each button on the door. That said, the proper (and scalable) way to make different buttons that all call the same way would be a blueprint interface that Hiraeth mentioned. They went over the concept greatly so the only thing I’ll add is the official documentation:

2 Likes

Thank you so much for this!

1 Like