# Animator.SetTrigger does not trigger an Animation

I have a basic animator setup for my Unity Character which has a "block" functionality when pressing the E key. So far, so good.

However I've made a transition from "Blocking Idle" to "Blocking_React" (which means that the character was hit) using a Trigger "tookDamage" (default to false). The problem is that the character gets hit but does not transition to "Blocking_React" animation.

Code Sample:

//From Character Controller script
if (Input.GetKeyDown(KeyCode.E) && !_isBlocking)
{
_animator.SetBool("isBlocking", true);
_isBlocking = true;
}
else if (Input.GetKeyUp(KeyCode.E) && _isBlocking)
{
_animator.SetBool("isBlocking", false);
_isBlocking = false;
}
//------------------------
//From my Character script

public void TakeDamage(float damage)
{
health -= damage;
this.GetComponent<Animator>().SetTrigger("tookDamage");
}


And this is my transition:

Am I missing something?

• Have you checked that TakeDamage method is called on hit? How you exit from the React state? Is the Idle state the active one upon hit? – Nikaas Nov 8 '17 at 9:01
• The TakeDamage method is called each time the player gets hit, yes! I simply linked the transition back to Blocking Idle with "has Exit Time" checked, nothing special! @Nikaas – Valamorde Nov 8 '17 at 10:08
• The only reason I see for this not to work is that you are not in the Standing_Block_Idle state when SetTrigger is called. – Uri Popov Nov 8 '17 at 12:26
• That's what is weird, while holding down "E" it enters the Standing_Block_idle state successfully, it just doesn't transition to Standing_Block_React_Large... @UriPopov Could it be a bug? – Valamorde Nov 8 '17 at 13:18
• I dont know I tried replicating it and it worked fine for me. You could try changing the blend on the transition maybe that is messing it up. – Uri Popov Nov 8 '17 at 13:32