using UnityEngine; using UnityEngine.SceneManagement; public class GameManager : MonoBehaviour { public static GameManager instance; private void Awake() { instance = this; } public int enemies = 0; public int enemiesDead = 0; public bool enemiesSpawned = false; private void Update() { if (enemiesSpawned) { if(enemiesDead == enemies) { Cursor.lockState = CursorLockMode.None; Cursor.visible = true; SceneManager.LoadScene("Win"); } } } }
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