Play animation on key press when inside of trigger

Hi everyone. What I’m trying to do is have the player character perform a specific animation only when inside of a trigger zone. The problem I have is that I cant figure out how to do this. I used “Animation”, “AnimationClip” and “Animator” but none of them worked when I used them. Clearly I’m doing something wrong and was hoping you could point it out. Below is the code I’m using to do this.

This piece of code is where I’m trying to implement the animation

using UnityEngine;
using System.Collections;

public class Action_Update : MonoBehaviour {
	//Inherits the _Trigger value from Action_Trigger.
	public Action_Trigger _Trigger;
	public GameObject _Object;
	public Animator _AnimationClip;
	
	void Start () {
		Debug.Log("Update is Starting");
		_AnimationClip.enabled = false;
	}
	
	void Update () {
		//Checks if variable from Action_Trigger is true and key "E" is pressed.
        //If both return true it  plays the animation.
		if(_Trigger.DoAction == true && Input.GetKey(KeyCode.E)){
			Debug.Log("Update is working");
			_AnimationClip.enabled = true;
		}

	}	
}

Try This Once
And check your _Trigger.DoAction wheather it is correct or not …!!!

using UnityEngine;
using System.Collections;

public class Action_Update : MonoBehaviour {
//Inherits the _Trigger value from Action_Trigger.
public Action_Trigger _Trigger;
public GameObject _Object;
public Animator _AnimationClip;

 void Start () {
     Debug.Log("Update is Starting");
     _AnimationClip.enabled = false;
 }
 
 void Update () {
     //Checks if variable from Action_Trigger is true and key "E" is pressed.
     //If both return true it  plays the animation.
     if(_Trigger.DoAction == true)
      {
       if( Input.GetKey(KeyCode.E)){
         Debug.Log("Update is working");
         _AnimationClip.enabled = true;
         }
     }

 }    

}

You are just enabling Animator component. This is not the way to start your animation.

I would recomend you to watch this tutorial: https://unity3d.com/ru/learn/tutorials/modules/beginner/live-training-archive/animate-anything