IEnumerator moveeff(Transform eff, Vector3 t1, Vector3 ver) { yield return(null); float t = 0; Vector3 inipos = eff.position; while (Vector3.Distance(eff.position, t1) > 25) { t += Time.deltaTime * 8; var next = PhysicsUtil.GetParabolaNextPosition(inipos, ver, -9.8f, t); eff.right = next - eff.position; eff.position = next; yield return(new WaitForEndOfFrame()); if (t > 20f) { break; } } t = Vector3.Distance(eff.position, efftarget.position); while (t > 10) { var dir = efftarget.position - eff.position; eff.position += dir * Time.deltaTime * 3; if (t < 100) { var t2 = t * 0.01f; eff.localScale = new Vector3(t2, t2, t2); } yield return(new WaitForEndOfFrame()); t = Vector3.Distance(eff.position, efftarget.position); } Destroy(eff.gameObject); }