Problems with Sliding Door Animation (solved)

OK… I’m suddenly getting problems with my door animations and I cant figure why.

Its a simple sliding door with 2 animations, one for open and one for close that activates as the player enters or leaves the ‘trigger’ area. I’m using a simple box collider that’s been extended forwards and backwards around the door, together with a very simple script-

#pragma strict

//Puts Drag n Drop variable slot into Script
var doorClip : AnimationClip;

function Start () {


function OnTriggerEnter () {

	animation.Play("SlideOpen3"); // Sets name of Animation clip to be played


function OnTriggerStay () {


function OnTriggerExit () {

	animation.Play("SlideClosed3"); // Sets name of Animation clip to be played


Everything worked fine until I added extra doors and now the animations play while the player is within the collision box (animations just played on enter and exit before)

Each door has its own animation and own script

At first I had all the doors from a prefab and realised this was changing settings on the other doors so I separated them all into individual parts and reset the scripts and animations.
Now that’s when the problem started, I’m guessing I don’t have a setting correct but cant see what is wrong?

An easier way for me to put it I think is that the close door animation is playing whenever I move within the collision box (not just on exiting the box as it should)

Thanks guys (or ladies)

OK… Im officially a noob…lol

The problem wasn’t my script OR my animation, It was me ! I hadn’t taken into consideration that using a prefab door would of course give me a prefab box collider.
So the problem was actually the size of my box (no innuendo plz) The newer doors had the same size collider but the newer doorways were slightly bigger. This meant that the box collider only covered half the open door space and as the player walked through that space the door opened and closed as the collider touched the player. As the door opened fully the collider thought the player had left the doorway and played the door close anim and as soon as it did it hit the player again and opened… DOH !

Anyway thanks for all your replies guys, you actually helped me to solve another little issue I had too.

Thanks, again