Skip to content

Instantly share code, notes, and snippets.

@moon-goon
Created April 13, 2016 08:32
Show Gist options
  • Save moon-goon/b0b5c6e9a97a7dfc6c938043c01cab23 to your computer and use it in GitHub Desktop.
Save moon-goon/b0b5c6e9a97a7dfc6c938043c01cab23 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class ClickToLoad : MonoBehaviour {
public void loadLevel(string nextLevel) {
StartCoroutine(DisplayLoading(nextLevel));
}
IEnumerator DisplayLoading(string nextLevel) {
// assigning Async task
AsyncOperation async = SceneManager.LoadSceneAsync(nextLevel);
// while async is running
while (!async.isDone) {
Debug.Log(async.progress);
yield return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment