using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class LoadScene : MonoBehaviour { public LoadSceneMode loadSceneMode = LoadSceneMode.Single; public void OnClickLoadScene(string sceneName) { StartCoroutine(LoadYourAsyncScene(sceneName)); } IEnumerator LoadYourAsyncScene(string sceneName) { AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName, loadSceneMode); // Wait until the asynchronous scene fully loads while (!asyncLoad.isDone) { yield return null; } } }