- Home /
Question by
AgoodplusCompany · Jun 17, 2018 at 06:44 AM ·
2d game
Unity 5.6.0 Memory leak when LoadSceneAsync
public void LoadingToLevel(string Level) {
StartCoroutine(DisplaayLoadingScreen(Level));
}
IEnumerator DisplaayLoadingScreen(string level)
{
background.SetActive(true);
AsyncOperation async = SceneManager.LoadSceneAsync(level, LoadSceneMode.Additive);
while (!async.isDone)
{
//while (!async.isDone)
float progress = Mathf.Clamp01(async.progress / .9f);
progressbar.fillAmount = progress;
System.GC.Collect();
yield return Resources.UnloadUnusedAssets();
yield return null;
}
SceneManager.UnloadSceneAsync("Start");
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612164919im_/https://answers.unity.com/themes/thub/images/avi.jpg)