IEnumerator Dead() { playerFSM.GainGold(gainGold); playerFSM.GainExp(gainExp); GetComponent <CharacterController>().enabled = false; agent.enabled = false; yield return(new WaitForSeconds(3.0f)); gameObject.SetActive(false); Invoke("Respawn", 3.0f); }