I did get inspired by this post, but my door uses a completely different approach to the door.
Making the Door
To get started, place 2 wooden poles (our doors) like this
Now hide the tilted one by default. I did not include this in the photo but It is advised to add a barrier to prevent collision bugs
Adding the code
To begin, we will add an invisible button to the center of the doors like this:
For our code, let’s add a new boolean property name isDoorOpen? with default value as false
To hold our code, let’s create a new trigger. This will contain our toggle.
Add a new script that runs on trigger. This is the code that will toggle our door:
I have an idea for an improvement. You could add buttons on both sides that activate a different prop so that it looks like it’s swinging in the direction that your walking in.
just realised, the problem with 2 buttons is they would have to be in range of each other. it would break if the user finds a spot where they can press both at the same time.