using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using Bansonic; public class back_toPreviousPage : MonoBehaviour { public string scene_turn_to_previous_scene = "selectYourSongFirst"; [Header("homepage")] public string homePage_sceneName_to_turn = "Main_main"; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } public void backto_PreviousPage() { StartCoroutine(LoadSceneAsync(scene_turn_to_previous_scene)); } public void backto_homePage() { StartCoroutine(LoadSceneAsync(homePage_sceneName_to_turn)); } private IEnumerator LoadSceneAsync(string sceneName) { if (gTransition.LoadScene(sceneName, LoadSceneMode.Single)) { while (gTransition.IsBusy) { yield return null; } yield break; } AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName); while (asyncLoad != null && !asyncLoad.isDone) { yield return null; } } }