using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class EndGame : MonoBehaviour { private void OnTriggerEnter2D(Collider2D collision) { if(collision.gameObject.CompareTag("Player")) //check if the player has reached the final door { SceneManager.LoadScene("End"); //load the end scene } } }