using UnityEngine; public class DeathZone : MonoBehaviour { private void OnCollisionEnter(Collision collision) { // Checks to make sure other collider is the Player. Sets player variable as Player game object and starts the coroutine. if (collision.gameObject.TryGetComponent(out PlayerDeath playerDeath)) { playerDeath.Respawn(); } } }