IEnumerator Harvest() { if (materialsRemaining == 0) { harvesting = false; player.playerState = PlayerState.Normal; playerCamera.GetComponent <ActionRPGCamera>().target = player.transform; Destroy(gameObject, 3.0f); return(false); } yield return(new WaitForSeconds(0.5f)); HarvestedItem = DeepCopy.CopyItem(HarvestedItem); ItemSpawner itemspawner = GameObject.FindGameObjectWithTag("ItemSpawner").GetComponent <ItemSpawner>(); itemspawner.SpawnAnItem(this.transform.position, HarvestedItem); materialsRemaining -= 1; yield return(new WaitForSeconds(0.3f)); StartCoroutine("Harvest"); }