using UnityEngine; using UnityEngine.SceneManagement; public class LoadNextScene : MonoBehaviour { public string nextSceneName; // the name of the next scene to load private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { SceneManager.LoadScene(nextSceneName); // load the next scene } } }