public async void LoginSuccess(Message[] parameters) { GameObject loading = GameObject.Find("Loading"); loading.transform.localScale = Vector3.one; AsyncOperation loadScene = SceneManager.LoadSceneAsync("Hangar", LoadSceneMode.Additive); while (!loadScene.isDone) { await Task.Delay(1); } Hangar hangar = GameObject.Find("Hangar").GetComponent <Hangar>(); hangar.InitHangar(Message.BoolValueOfKey(parameters, "firsttime")); SceneManager.SetActiveScene(SceneManager.GetSceneByName("Hangar")); AsyncOperation unloadScene = SceneManager.UnloadSceneAsync("Login"); while (!unloadScene.isDone) { await Task.Delay(1); } }