So I have this code :
AsyncOperation async;
public void Start ()
{
StartCoroutine (LoadingScreen ());
}
IEnumerator LoadingScreen ()
{
yield return new WaitForSeconds (1);
async = SceneManager.LoadSceneAsync (1);
async.allowSceneActivation = false;
while (!async.isDone) {
if (async.progress == 0.9f) {
async.allowSceneActivation = true;
}
yield return null;
}
}
The game still freezes before it loads another scene. I want the game to still smoothly load while it is loading a different scene, how can I do that? Have I done anything wrong with my code?
↧