IEnumerator SpawnSlime() { GameObject newslime = Instantiate(SlimeObj, transform.position - 2 * transform.up, transform.rotation); Slime slimescript = newslime.GetComponent <Slime>(); slimescript.DoInit(); slimescript.ForceMotion(true); float height = 0; while (height < 2) { newslime.transform.position += transform.up * Time.deltaTime; height += Time.deltaTime; yield return(null); } slimescript.ForceMotion(false); }