public async void LoadScene(Scene sceneId) { loadingScreen.SetActive(true); progressBar.value = 0; AsyncOperation operation = SceneManager.LoadSceneAsync((int)sceneId); operation.allowSceneActivation = false; do targetFill = operation.progress; while (operation.progress < 0.9f); operation.allowSceneActivation = true; await Task.Delay(2000); loadingScreen.SetActive(false); }