title: Is it possible to force the "Animator" to end any animation and execute any animation I want?
body: <p>first of all, forgive me if my question is too trivial, that's because I am new in Unity, and I have some difficulty getting documentation. What I want is to move a character from one position to another running animation walking. The animations are launched through an controller animation "Animator". the problem is that When I launch a trigger to start the animation, the character does not stop the previous animation to perform the animation I ask, that results in a desynchronization: The character starts to move with the animation it has at the time. I've tried many things, but I can not find the problem.
  this is may Animator:
  <img src="https://i.stack.imgur.com/bA0yh.jpg" alt="enter image description here"></p>
  
  <p>and this is de code i have:</p>
  
  <pre><code>enum AnimTriger {IdleTrigger, SpawnTrigger, RunTrigger, AttackTrigger, DeadTrigger, VictoryTrigger };
  public class CharacterController : MonoBehaviour {
      private GameObject target, origin;
      private bool isWalking = false;
      private bool isMele = false;
      private GameObject instigator;
  
  
  
      public void goAndAttack(GameObject instigator, GameObject target,GameObject origin, bool mele)
      {
          this.target = target;
          this.origin = origin;        
          this.instigator = instigator;
          isMele = mele;
          StartCoroutine(AttackAction());
  
      }
  
      private IEnumerator AttackAction()
      {
          Animator anim = instigator.GetComponent&lt;Animator&gt;();
  
          yield return new WaitForSeconds(anim.GetCurrentAnimatorStateInfo(0).length);        
          if (isMele)
          {
              anim.SetTrigger(AnimTriger.RunTrigger.ToString());
              yield return new WaitForSeconds(anim.GetCurrentAnimatorStateInfo(0).length);
              isWalking = true;
              while (isWalking)
              {
                  yield return new WaitForFixedUpdate();
              }
              yield return new WaitForSeconds(anim.GetCurrentAnimatorStateInfo(0).length);
  
          }
  
          anim.SetTrigger(AnimTriger.AttackTrigger.ToString());
          if (isMele)
          {
              anim.SetTrigger(AnimTriger.RunTrigger.ToString());
              target = origin;
              yield return new WaitForSeconds(anim.GetCurrentAnimatorStateInfo(0).length);
              isWalking = true;
              while (isWalking)
              {
                  yield return new WaitForFixedUpdate();
              }
              yield return new WaitForSeconds(anim.GetCurrentAnimatorStateInfo(0).length);
          }
          anim.SetTrigger(AnimTriger.IdleTrigger.ToString());
  
      }
  
      void Update () {
          if (isWalking &amp;&amp; isMele)
          {
              instigator.transform.position = Vector3.MoveTowards(instigator.transform.position, target.transform.position, 0.1f);
              isWalking = instigator.transform.position != target.transform.position;
          }
  
  
      }
  
  
  }
  </code></pre>
  
  <p>Is it possible to force the "Animator" to end any animation and execute any animation I want?<br>
  Thanks in advance for any help you can give me on this problem</p>