/// <summary> /// Adds the listener for loading finished. /// </summary> /// <remarks> /// Ensures that the object will be reactivated if without a loading system active, /// for example when playing the level in the editor out of sequence. /// </remarks> private void Awake() { if (LoadingTransitionController.Exists()) { gameObject.SetActive(false); } LoadingTransitionController.OnLoadingFinished += ActivateGameObject; }
/// <summary> /// Handles if there is no transition controller. /// </summary> private void Start() { if (!LoadingTransitionController.Exists()) { // no transition controller so disable updating. enabled = false; } }
/// <summary> /// Loads the scenes set on the object. /// </summary> public void LoadScene() { if (useLoadingScene) { LoadingTransitionController.AnimatedLoadSceneAsync(nextScene, loadingScene, overrideMinTransitionDuration); } else { LoadingTransitionController.AnimatedLoadSceneAsync(nextScene, overrideMinTransitionDuration); } }
/// <summary> /// Updates the loading display text. /// </summary> private void Update() { text.text = "Loading... " + LoadingTransitionController.Progress().ToString("P0"); }