Making a switch for doors
I'm new to unity and I want to a switch that will stop multiple doors from play its animation and also unlock some doors. I have no idea how should I start....
Answer by hexagonius · Sep 14, 2015 at 07:33 PM
Create a gameobject which is the trigger and add any 3D collider to it with isTrigger set to true. Add as many public Animator variables to a script and add it to the trigger as you have doors. when that object is selected you should see the slots in the inspector. drag all the doors on the, if they have an Animator they get assigned. Use OnTriggerEnter(Collider col){} in the script and check col for being player, for example by tag. If it's the player call whatever method you need on the animators to tell the doors what to do.
This is just a rundown but by searching for all the words I used you should be able to get the hang of this.