private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Enemy")) { GameObject myDeathObj = Instantiate(deathObj, transform.position, transform.rotation); DeathScript myScript = myDeathObj.GetComponent <DeathScript>(); myScript.deathAudio = collideDeathAudio; mainManager.PlayerDeath(); Destroy(gameObject); } if (other.CompareTag("Death Area Tag")) { GameObject myDeathObj = Instantiate(deathObj, transform.position, transform.rotation); DeathScript myScript = myDeathObj.GetComponent <DeathScript>(); myScript.deathAudio = fallDeathAudio; mainManager.PlayerDeath(); Destroy(gameObject); //StartCoroutine(DelayedRespawn(2f)); } if (other.gameObject.CompareTag("Finish Line")) { CrossFinish(); } if (other.gameObject.CompareTag("Coin")) { mainManager.CollectCoin(); Destroy(other.gameObject); } if (other.gameObject.CompareTag("Finish Line")) { mainManager.CrossFinish(); } }