public void Load(string toLoad) { LoadTransferer l = Instantiate(loadTransferer, this.transform.position, Quaternion.identity) as LoadTransferer; l.sceneToLoad = toLoad; SceneManager.LoadScene("Loading"); }
// Use this for initialization void Start() { LoadTransferer l = FindObjectOfType <LoadTransferer> (); if (l != null) { StartCoroutine(LoadAsync(l)); } }
private IEnumerator LoadAsync(LoadTransferer l) { AsyncOperation operation = SceneManager.LoadSceneAsync(l.sceneToLoad); Destroy(l.gameObject); while (!operation.isDone) { Debug.Log(operation.progress); yield return(null); } }