지금 코르기엔진에 비동기로드를 쓰고 있거든
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | protected virtual IEnumerator LoadAsynchronously() { // we setup our various visual elements LoadingSetup(); // we fade from black MMFadeOutEvent.Trigger(StartFadeDuration, _tween); yield return new WaitForSeconds(StartFadeDuration); // we start loading the scene _asyncOperation = SceneManager.LoadSceneAsync(_sceneToLoad, LoadSceneMode.Single); _asyncOperation.allowSceneActivation = false; // while the scene loads, we assign its progress to a target that we'll use to fill the progress bar smoothly while (_asyncOperation.progress < 0.9f) { _fillTarget = _asyncOperation.progress; yield return null; } // when the load is close to the end (it'll never reach it), we set it to 100% _fillTarget = 1f; // we wait for the bar to be visually filled to continue while (_progressBarImage.fillAmount != _fillTarget) { yield return null; } // the load is now complete, we replace the bar with the complete animation LoadingComplete(); yield return new WaitForSeconds(LoadCompleteDelay); // we fade to black if (ExitFadeDuration > 0f) { MMFadeInEvent.Trigger(ExitFadeDuration, _tween); yield return new WaitForSeconds(ExitFadeDuration); } // we switch to the new scene _asyncOperation.allowSceneActivation = true; LoadingSceneEvent.Trigger(_sceneToLoad, LoadingStatus.LoadTransitionComplete); } | cs |
로드 할 때랑 마지막에 allowSceneActivation = true; 할때도 조금씩 멈춰버리는데
어떻게하면 안멈추게 할 수 있어?
해결책이 될지 모르겠지만. 씬을 호출할때 빈 씬을 불러서 비우고 불러야할 다음 씬을 부르면 랙을 줄일 수 있어. ex) A > C(빈 씬) > B 일반적으로 호출한다면 A씬을 지우는거(오브젝트 지우기,가비지 컬렉터 비우기 etc)+ B씬을 호출하는거 가 동시에 작동해서 멈추거나 랙이 유발됨 위 경우 처럼 한다면 A씬 지우는거 완료 후 > B씬 호출하는거 가 되서
좀더 피크가 치지 않게 만드는거야 이걸 독하게 하는 사람은 오브젝트를 직접날리면서 가비지 컬렉터 비워가면서 하시던데 효과적인진 모르겠음.
GC 수동으로 비우는 걸 생각 못했네. 고마워