public void Awake() { gameController = GameObject.Find("GameController"); popupMessage = gameController.GetComponent <PopupMessage>(); popupMessage.Close(); if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); enemies = new List <Enemy>(); boardScript = GetComponent <BoardManager>(); if (MainMenu.loadBoolea) { LoadGame(); LoadPlayer(); } else { } InitGame(); }
static private void OnSceneLoaded(Scene arg0, LoadSceneMode arg1) { if (inici) { inici = false; } else { GameObject gameController = GameObject.Find("GameController"); PopupMessage popupMessage = gameController.GetComponent <PopupMessage>(); popupMessage.Close(); instance.level++; instance.InitGame(); } }