Answers for "load scene async unity"

C#
13

unity load scene

using UnityEngine.SceneManagement;

int buildIndex = 0;
//Load the scene with a build index
SceneManager.LoadScene(buildIndex);
Posted by: Guest on April-18-2020
1

unity loadsceneasync callback

using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Example : MonoBehaviour
{
    void Update()
    {
        // Press the space key to start coroutine
        if (Input.GetKeyDown(KeyCode.Space))
        {
            // Use a coroutine to load the Scene in the background
            StartCoroutine(LoadYourAsyncScene());
        }
    }

    IEnumerator LoadYourAsyncScene()
    {
        // The Application loads the Scene in the background as the current Scene runs.
        // This is particularly good for creating loading screens.
        // You could also load the Scene by using sceneBuildIndex. In this case Scene2 has
        // a sceneBuildIndex of 1 as shown in Build Settings.

        AsyncOperation asyncLoad = SceneManager.LoadSceneAsync("Scene2");

        // Wait until the asynchronous scene fully loads
        while (!asyncLoad.isDone)
        {
            yield return null;
        }
    }
}
Posted by: Guest on November-20-2020
2

unity how to load a scene

SceneManager.LoadScene("Game");
Posted by: Guest on February-13-2020

C# Answers by Framework

Browse Popular Code Answers by Language