Open a door from a UI button

Hello guys! I have a door and a widget. I want to make it so when I press a button in the widget it opens the door. Problem is that I have multiple doors in the same level, so when I try to “get all actors of class” it opens all of them. This is the blueprint for the door:


This is the blueprint for the widget:

Any help is appreciated!

1 Like

Hey @Vlahui_on_pc! So let me ask a couple questions before continuing so I know the best path to take you down.

Is this a “fnaf” type situation where you have set doors that will always be in the same location? If so, this will be easy peasy!

Do you want to have each door have it’s own widget for the open and close functions?

1 Like

Thanks for responding!
The doors will be in the same location.
I want a universal button for all actions (it’s the hand icon):


Here’s an example as to how the doors are positioned:

Just a long hallway with doors.

1 Like

Ohhh okay, I got you now.

I thought maybe you’d be stationary/ in some kind of control room.

So for this, you’re going to want to rewrite this almost entirely. Put a tag on the doors themselves called “Interactable”.

Then you’ll put this in on your Player Character. Make a new Custom Event, then use that as the “Start” for this.

Right click and break the “Out hit” pin, grab “Hit Actor” and use “Actor has tag”, with “Interactable” as the tag check (to make sure it’s a door).
Plug that into a bool above. Off true, grab “Hit Actor” from the trace again, cast it to “yourDoorBP” and have it run your “Door Opening” event! :slight_smile:

On the widget, on button press you’ll just "GetPlayerCharacter ->Cast to “yourPlayerBP”, ->Call “yourCustomEvent”.

3 Likes

Love you dude, you saved hours of research! Keep it up and thank you very much!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.