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