IEnumerator Loader(string levelName) { AsyncOperation async = Application.LoadLevelAsync(levelName); while (!async.isDone) { if (lvlLoadingDone) { b.Value = 0.6f + (async.progress) * 0.4f; } yield return(async.isDone); //LoadingBar.setValue(async.progress); //Debug.Log("Loading at " + async.progress); yield return(new WaitForEndOfFrame()); } //Debug.Log("Completed Loading of :: " + levelName); if (lvlLoadingDone) { Destroy(gameObject); } else { lvlLoadingDone = true; b = FindObjectOfType <SegmentedBar>(); } }
IEnumerator Loader(string levelName) { AsyncOperation async = Application.LoadLevelAsync(levelName); while (!async.isDone) { if (lvlLoadingDone) b.Value = 0.6f + (async.progress) * 0.4f; yield return async.isDone; //LoadingBar.setValue(async.progress); //Debug.Log("Loading at " + async.progress); yield return new WaitForEndOfFrame(); } //Debug.Log("Completed Loading of :: " + levelName); if (lvlLoadingDone) Destroy(gameObject); else { lvlLoadingDone = true; b = FindObjectOfType<SegmentedBar>(); } }