This is a very basic package for creating doors, and is aimed towards people who are just getting started with unity.
List of current features
*Doors open when the player approaches, and close when the player moves away.
*Doors can be set to open only once.
*Doors can be set to open only when a switch has been activated.
Future additions
*Ability to open a door when you have the key
*Built in animations.
*Some documentation.
Feel free to use it in any project. No credit required (though it would be nice).
Hopefully someone will find it usefull:)
If you like the script, don’t like it, have some ideas for future updates or just have a question, feel free to let me know.
It does require animations that you can make yourself in the Unity editor. Once the animations have been created, the script should handle the rest. The reason I made the script use animations is so you have full control over how the door behaves.
No problem. The door script should be attached to whatever object you would like to use as a door. The switch script is attached to any object you would like to use as a trigger.
No specific tag is needed for the doors. The tag “player” is needed for the player (it is already built into unity, so you just need to set it).
I will upload an example shortly so you can see how the doors work.
I have gotten one door working using this package. Great job!!
I am trying to get a second door working on the same game level and it just does not open.
Would you please specify how this can be done.
I have been trying for a while now with no positive results.
EDIT: I have it fixed.
In the second switch script I changed this line " DoorOpen.switchActivated = switchName;" to match the name of my new animation “Door2Open.switchActivated = switchName;”
Door2Open is the name of the animation that I created in unity for the new door.
Just have to remember to created one new script for the new door and the new switch both and change the name of the animations to match the names of the animations of the door in unity.
Hope this helps some other people who might have struggled with this.