#Minifreeze
1 messages · Page 1 of 1 (latest)
Modified it a little
ah i closed normal debug logs, lemme record again
AsyncOperation mainscene;
IEnumerator GO()
{
ReferenceHolder.Instance.mainCharacterController.canTakeMoveInput
= ReferenceHolder.Instance.mainCharacterController.canTakeMoveInput_MENU = false;
foreach(var item in ThingsToClose)
{
item.SetActive(false);
}
GameOverUI.SetActive(true);
GoToMain.gameObject.SetActive(false);
mainscene = SceneManager.LoadSceneAsync("AAScene/MainMenu");
mainscene.allowSceneActivation = false;
float timer = 0;
while (!mainscene.isDone)
{
if (mainscene.progress < 0.9f)
{
Debug.Log($"Progress: <color=cyan>{mainscene.progress}</color>.");
timer += Time.deltaTime;
yield return null;
}
if (timer < MinimumWait)
{
Debug.Log($"Timer: <color=cyan>{timer }</color>.");
timer += Time.deltaTime;
yield return null;
}
else
{
GoToMain.gameObject.SetActive(true);
}
// mainscene.allowSceneActivation = true;
}```
omg... code actually froze unity ðŸ˜
i'm not sure what happens when you wait for an outside source to change the state of the async operation. that's why i set the activation to true to determin if it'll automatically load. we can place an exit clause inside the while to stop it from freezing, gimme a sec . . .