Making a sliding door that is unlocked with a key in unity
<p>I've been trying to make a sliding door for my unity level and I've managed to set up the animations but the scripting that's supposed to link up the functions with the objects isn't working.</p>

<p>Here's the script for the key card:</p>

<pre><code>using UnityEngine;
using System.Collections;

public class Key_Pickup_1 : MonoBehaviour {


public GameObject player;
private Player_inventory playerinventory;

void Awake ()
{
    playerinventory = player.GetComponent&lt;Player_inventory&gt;();
}

// Update is called once per frame
void onTriggerEnter()
   {

    if (gameObject == player)
    {
        playerinventory.hasKey_1 = true;
        Destroy(gameObject);
    }

   }
}
</code></pre>

<p>Here's the script for the Door animation:</p>

<pre><code>    using UnityEngine;
    using System.Collections;

    public class Door_Animation_1 : MonoBehaviour {

    public string Open;
    private Animator anim_1;
    public GameObject player;
    private Player_inventory playerInventory;

    void Start()
{
    anim_1 = GetComponent&lt;Animator&gt;();
    player = GameObject.FindGameObjectWithTag("Player");
    playerInventory = player.GetComponent&lt;Player_inventory&gt;();
}

void OntriggerEnter (Collider other)
{
    if(other.gameObject == player)
    {
        if (playerInventory.hasKey_1)
        {
            anim_1.SetTrigger(Open);

        }
    }
}
</code></pre>

<p>Any Ideas?</p>