using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class LogOutScript : MonoBehaviour { // Start is called before the first frame update void Start() { StartCoroutine(changeText()); StartCoroutine(deleteFile()); } IEnumerator deleteFile() { AsyncOperation loadScene = SceneManager.LoadSceneAsync("Login"); loadScene.allowSceneActivation = false; WriteFile writeFile = GetComponent(); writeFile.DeleteFile(); yield return new WaitForSecondsRealtime(2.5f); while (loadScene.progress != 0.9f) { yield return new WaitForEndOfFrame(); } loadScene.allowSceneActivation = true; SceneManager.UnloadSceneAsync("LogOut"); } IEnumerator changeText() { Text text = GameObject.Find("Loading").GetComponent(); while (true) { text.text = "Loading."; yield return new WaitForSecondsRealtime(0.75f); text.text = "Loading.."; yield return new WaitForSecondsRealtime(0.75f); text.text = "Loading..."; yield return new WaitForSecondsRealtime(0.75f); text.text = "Loading"; yield return new WaitForSecondsRealtime(0.75f); } } }