OnTriggerEnter?

I have this code here:

function OnTriggerEnter (player : Collider) {
    if(player.tag=="Player")
    GameObject.Find("door").animation.Play("1");
}

What i am trying to do is to get the door to open with the animation “1” while entering an box with disabled mesh renderer and box colider. Animation works, i tested it with a test script while pressing the space key.

The question: How do i get to play the animation “1” while entering a box with disabled mesh renderer and box colider?

Sorry for the confusion.

Be sure that:

  1. Both the Player and the the box have a collider with ‘Is Trigger’ enabled
  2. The Player (and possibly the box) has a Rigidbody Component
  3. The Player’s tag is ‘Player’ (case sensitive)
  4. The Door is called ‘door’ (case sensitive) and the animation is called ‘1’

Could you please define the problem a little more clearly?

Is the issue that the the OnTriggerEnter function isn’t being called when the player object enters the collider on the door?

It has to be like this:

function OnTriggerEnter (player : Collider) {
    if(player.gameObject.tag=="Player") {
        GameObject.Find("door").animation.Play("1");
    }
}

Thank you so much. I’ve been trying to get this to work for hours.