Here's my code:
IEnumerator SceneIsInChange(AsyncOperation SecondScene)
{
Snake.SetActive(true);
print("1: " + FinalLoop);
while (!SecondScene.isDone)
{
yield return null;
}
Snake.GetComponent<Animator>().SetBool("Loaded", true);
print("2: " + FinalLoop);
while (!FinalLoop)
{
yield return null;
}
print("3: " + FinalLoop);
Time.timeScale = 1;
Loading = false;
LoadingScene = null;
}
The problem is that the coroutine gets suspended before print("2: " + FinalLoop);
line. (But print("1: " + FinalLoop
works) So the problem should be in the first while loop but I can't find it. There's only one single code in that loop but it's supposed to "wait for one frame before resuming coroutine" so it shouldn't stop the coroutine.
Am I wrong about yield return null;
meaning or the problem is somewhere else?