How to make the animation play and then the object changed coordinates, now the opposite is happening ?
_animator.Play("Animation");
WaitForAnimation(_animator);
transform.position = StartPoint;
dest = transform.position;
Vector2 dir = Vector2.zero;
_animator.SetFloat("DirX", 1);
_animator.SetFloat("DirY", 0);
private IEnumerator WaitForAnimation(Animator animation)
{
do
{
yield return null;
} while (animation.GetCurrentAnimatorStateInfo(0).IsName("Animation"));
}