public void GenerateNextLevel() { if (_firstLevel == false) { Debug.Log("Transition"); shadeStart.SetActive(true); shadeStart.GetComponent <Animator>().Play("Shade start", -1, 0); } StartCoroutine(loadCoroutine()); IEnumerator loadCoroutine() { yield return(new WaitForSeconds(0.7f)); onDescending.Invoke(); Destroy(descent); descentWasSpawned = false; needsToLoadNextLevel = false; nextLevelMenu.SetActive(false); generateLevel.GenerateRandomLevelPrefab(); _gridBehavior.ResetGrid(); oreGenerator.GenerateNextLevelOres(); // _gridBehavior.GenerateGrid(); bonusOresMenu.UpdateValue(); progressBar.Reset(); PointerController.DisablePointer(); Statistics.SetMaxLevelReached(oreGenerator.currentLevel); if (_firstLevel == false) { shadeStart.SetActive(false); } shadeEnd.GetComponent <Animator>().Play("Shade end", -1, 0); _firstLevel = false; _dataController.SaveBaseOnCurrentScene(); } }