using System.Collections; using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; using UnityEngine.SceneManagement; public class EndFlag : MonoBehaviour { public string nextSceneName; public bool lastLevel; private void OnTriggerEnter (Collider other) { if(other.CompareTag("Player")) { if(lastLevel == true) { SceneManager.LoadScene(0); } else { SceneManager.LoadScene(nextSceneName); } } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter