Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

loading screen unity


IEnumerator load(){
    yield return null;

    //Begin to load the Scene you specify
    AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(sceneIndex);
    //Don't let the Scene activate until you allow it to
    asyncOperation.allowSceneActivation = false;
    Debug.Log("Pro :" + asyncOperation.progress);
    //When the load is still in progress, output the Text and progress bar
    while (!asyncOperation.isDone)
    {
        //Output the current progress
        Debug.Log("Loading progress: " + (asyncOperation.progress * 100) + "%");

        // Check if the load has finished
        if (asyncOperation.progress >= 0.9f)
        {
            //Change the Text to show the Scene is ready
            asyncOperation.allowSceneActivation = true;
        }

        yield return null;
    }
}

Source by nullorempty.org #
 
PREVIOUS NEXT
Tagged: #loading #screen #unity
ADD COMMENT
Topic
Name
1+6 =