public IEnumerator GenerateNewLevel() { levelGenerating = true; cameraController.zoomed = false; terrainGenerator.GenerateNewTerrain(); windController.GenerateNewWind(); // generates a level layout Debug.Log("World created"); yield return(new WaitForFixedUpdate()); // waits for game to finish generating the layout cannonController.ResetCannon(); cannonController.RandomizeBulletType(); // updates the target and cannon target.GenerateNewAngle(); prefabPlacer.UpdatePos(); Debug.Log("Objects updated"); yield return(new WaitForFixedUpdate()); // waits for the the cannon and target to be updated UIManager.UpdateWindGraphic(); cannonController.CreateNewBullet(); // finishing touches, such as initializing the bullet, updating wind Debug.Log("GUI initiated"); cameraController.StartCoroutine(cameraController.ShowLevel()); // starts the level preview cannonController.ResetCannon(); Debug.Log("Level Loaded"); levelGenerating = false; }