How to change states in OnTriggerEnter

Hey,

I’m having a problem. I have my animation set up with enumerated states and a switch statement in Update.

 public enum AnimationState
    {
        Idle,
        Moving,
        Hit,
        Attacking,
        Dying,
        Dead
    }
    public AnimationState animState
    {
        get
        {
            return _animState;
        }
        set
        {
            // only update the state if it has changed
            if (_animState != value)
            {
                _animState = value;
            }
        }
    }
private void Update ()
	{
            switch (_animState)
             {
            case AnimationState.Idle:
                PlayAnimation("idle");
                anim.AnimationCompleted = null;
                velocity = Vector3.zero;

                break;

            case AnimationState.Moving:
                PlayAnimation("walk");
                anim.AnimationCompleted = null;

                break;

            case AnimationState.Hit:
                PlayAnimation("hit");
                velocity = Vector3.zero;
                anim.AnimationCompleted = HitCompleteDelegate;
                
                break;

            case AnimationState.Attacking:

                break;

            case AnimationState.Dying:

                break;

            case AnimationState.Dead:

                break;
        }

Then in a separate script I try to change the state through the public property in the other class:

   private Enemy baseScript;


	// Use this for initialization
	void Start ()
	{
	    baseScript = transform.parent.GetComponent<Enemy>();
	}
	
void OnTriggerEnter (Collider other)
{
   if (other.gameObject.tag == "Player Attack")
   {
        baseScript.animState = Enemy.AnimationState.Hit;
   }
}

Yet nothing happens when the player trigger collides with the enemy hitbox, besides from a debug.log that says “hit” which I put to make sure they’re actually colliding.

Is there some better way to do this? Also, would it be more practical to store enums outside classes? If so, how would you access them (I dont remember ever doing that).

Thanks in advance.

Are you sure you have bodies attached to the character? Unity apparently requires a body in order to generate collision events. If you don’t want the body characteristics then make it kinematic and you’ll get the collision detection without the physics.