IEnumerator PressButtonAnim() { float t = 0.0f; Vector3 StartPos = transform.position; Debug.Log("Start:" + StartPos); Vector3 TargetPos = Vector3.zero; TargetPos.y = StartPos.y; TargetPos = Vector3.Lerp(StartPos, TargetPos, DistInsert / Vector3.Distance(StartPos, TargetPos)); Debug.Log("Target" + TargetPos); bIsPressed = true; while (t < TimeInsert) { t += Time.deltaTime; float u = ButtonAnimation.Evaluate(t / TimeInsert); transform.position = Vector3.Lerp(StartPos, TargetPos, u); yield return(null); } MyGameManager.ButtonAction(ButtonType); bIsPressed = false; }