Using unityengine; using system. collections; public class loadingscene: monobehaviour {public uislider processbar; private asyncoperation async; private uint _ nowprocess; // use this for initialization void start () {_ nowprocess = 0; startcoroutine (loadscene ();} ienumerator loadscene () {// asynchronous read scenario. // Globe. loadname is the name of the C scenario to be read in Scenario. Async = application. loadlevelasync (globalvaule. loadlevelname); async. allowsceneactivation = false; // after reading is completed, the system automatically enters the yield return async;} void Update () {If (async = NULL) {return ;} uint toprocess; debug. log (async. progress * 100); If (async. progress <0.9f) // progress ss of the potholes, up to 0.9f {toprocess = (uint) (async. progress * 100);} else {toprocess = 100;} If (_ nowprocess <toprocess) {_ nowprocess ++;} processbar. value = _ nowprocess/100f; If (_ nowprocess = 100) // async. isdone should be true {async when the scenario is activated. allowsceneactivation = true ;}}}
It's relatively simple. I directly went to the code and commented out some of the pitfalls ~
Unity asynchronous loading scenario loading entries