private float loadProgress = 0;
void OnGUI() {
GUI
.Label (new Rect
(500,
20,
100,
30),
"menu");
if (GUI
.Button (new Rect
(25,
75,
100,
70),
"RACE")) { // Application.LoadLevel(2);
StartCoroutine(DisplayLoadingScreen(levelToLoad));
}
IEnumerator DisplayLoadingScreen(string level) {
GalvKamer.SetActive(false);
MenuSkr.SetActive(false);
UIroots.SetActive(true);
AsyncOperation async = Application.LoadLevelAsync(level);
while (!async.isDone) {
//loadProgress = (int)(async.progress*100);
loadProgress = async.progress;
yield return null;
}
}
// Update is called once per frame
void Update () {
Progress();
}
public void Progress () {
loadProgress = UIProgressBar.current.value;
}
}