Script that detects if the player has fallen off the edge of a platform and respawns them back to the start.
using UnityEngine; public class PlayerRespawn : MonoBehaviour { public Transform startPosition; private void Update() { if (transform.position.y < -10f) { transform.position = startPosition.position; } } }