can someone help me because dont know why StartCoroutine is overloaded when I saw on youtube he cant get overloaded I check many times on youtube my code is the same to him please this very important
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class LoadingSceneScript : MonoBehaviour {
public LoadingBarScript LoadingBar;
private AsyncOperation AsyncLoad;
public string SceneToLoad;
// Use this for initialization
void Start () {
LoadingBar.OnChange (this.OnLoadingBarChange);
LoadingBar.OnDone (this.OnLoadingBarDone);
StartCoroutine (this.LoadAsyncScene ());
}
// Update is called once per frame
void Update () {
}
void OnLoadingBarChange(float value)
{
print ("Progress is : " + value);
}
void OnLoadingBarDone()
{
print ("Progress is Done!");
AsyncLoad.allowSceneActivation = true;
}
IEnumerable LoadAsyncScene()
{
AsyncLoad = SceneManager.LoadSceneAsync (this.SceneToLoad);
AsyncLoad.allowSceneActivation = false;
while (!AsyncLoad.isDone) {
LoadingBar.SetValue (Mathf.Clamp01 (AsyncLoad.progress / 0.9f));
yield return null;
}
}
}