Easy Doors

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.

Scripts only - 843809–31835–$Easy Doors.unitypackage (1.88 KB)

Scripts with example - 843809–32141–$Easy Doors Example.unitypackage (63.3 KB)

Reserved

Hi Sir TiIddlesworth,

as a person just getting started, I tried the to use this but did not succeed. Actually, the script appears to be looking for some animation files…

Hi Sir TiIddlesworth,

as a person just getting started, I tried the to use this but did not succeed. Actually, the script appears to be looking for some animation files…

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.

Here is some information on how to use the animation editor in Unity - http://unity3d.com/support/documentation/Manual/Animation.html

Sorry for the late reply.

The scripts have been updated.

  • The switch now works correctly
  • You can now add your own opening and closing sounds.

Sir.TIddlesworth this is very kind of you. Could you just clarify what script should be attached to what object?

Also do we need to create specific tags for the doors and the player? what should we call them?

Sorry for my ignorance, and thank you for your wisdom!

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.

Example uploaded.

Bump

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.

Peace and Love :slight_smile:

Hi Tiddlesworth. This really helped me save some time and frustration. Thanks for the great door script.