IEnumerator LoadCoroutine() { AsyncOperation operation = SceneManager.LoadSceneAsync(sceneName); while (!operation.isDone) { yield return(null); } theSaveNLoad = FindObjectOfType <SaveNLoad>(); theSaveNLoad.LoadData(); Destroy(gameObject); }
IEnumerator LoadCoroutine() { //SceneManager.LoadScene(scnenName); AsyncOperation operation = SceneManager.LoadSceneAsync(scnenName); // 동기화 while (!operation.isDone) // while문 안에다가 로딩 화면 만들어줘도 좋음. (opeartion.process 이용) { yield return(null); } // 로딩이 끝날 때까지 1프레임씩 대기하다가 로딩이 끝나면 while문 벗어나서 데이터 호출. // Awake에서 부르면 이미 파괴되었기때문에 여기서 찾아줘야함. theSaveNLoad = FindObjectOfType <SaveNLoad>(); theSaveNLoad.LoadData(); gameObject.SetActive(false); // DontDestroy 때문에 Destroy로는 안먹힘. }
IEnumerator LoadCoroutine() //로드씬을 한 후 바로 로드 데이터를 하면 너무 빠르게 이루어져 씬이 전부 불러와지지 않았는데, 로드데이터를 하여 null이 출력될 수 있다. 동기화를 위해 텀을 줘야한다. { AsyncOperation operation = SceneManager.LoadSceneAsync(sceneName); //싱크를 맞추기 위해 로딩관련 일을 할 수 있는 것 go_LoadingBar.SetActive(true); //로딩바 나오게 while (!operation.isDone) //로딩이 끝날 때까지 { loadingBar.value = operation.progress; //로딩바 값 yield return(null); //대기 } go_LoadingBar.SetActive(false); theSaveNLoad = FindObjectOfType <SaveNLoad>(); theSaveNLoad.LoadData(); this.gameObject.SetActive(false); }
public void ClickLoad() { print("load"); theSaveNLoad.LoadData(); }
public void ClickLoad() { Debug.Log("로드"); theSaveNLoad.LoadData(); }