When switching scenes, use application directly. Loadlevel () This method, if the load of the scene resources too much, will be stuck for a period of time.
So, with a transition scenario, the experience is a little bit better.
So let's start with a transition scenario (called: Loading). (like Jiangzi below, a picture of Baidu)
To switch the scene, Application.loadlevel ("Loading"), first switch to this Loading scene, Loading scene resources, on a background map and a slider, so, the direct synchronous loading came quickly
Then, write this script in the loading scene.
1 Public classLoading:monobehaviour {2AsyncOperation asyncoperation;//Asynchronous Variables3 PublicGameobject Slider;//progress bar4 PublicGameobject Text;//text on the progress bar5 //Initialize the above variables6 voidStart ()7{TenText.getcomponent<text> (). Text ="0"; OneProgress. Getcomponent<image> (). Fillamount =0f; A dontdestroyonload (gameobject); -Startcoroutine (Loadscene ());//Open Asynchronous task, enter Loadscene method - } the voidUpdate () - { -Text.getcomponent<text> (). Text = (float) asyncoperation.progress* -+Ten+"%";//Text Update Asynchronous Progress -Progress. Getcomponent<image> (). Fillamount = (float) asyncoperation.progress+.1f;//Progress bar updates Asynchronous Progress + } - IEnumerator loadscene () + { A yield returnAsyncOperation = Application.loadlevelasync (2);//automatic access to the next scene after reading at } - -}
Asynchronous loading scenarios and loading progress bar making