Created
April 13, 2016 08:32
-
-
Save moon-goon/b0b5c6e9a97a7dfc6c938043c01cab23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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