- Home /
Playing a sequence of images during LoadLevelAsync?
I have a sequence of images that show my character running on a black screen. This works fine if I have it active when the scene plays but i am trying to play it when loading levels. The level loads and the image shows but it runs very slow or sometimes its just a static image and the animations don't play.
I am using this LoadLevelAsync code below:
void Update()
{
if (Input.GetKeyDown(KeyCode.G))
{
StartCoroutine(DisplayLoadingScreen());
}
}
IEnumerator DisplayLoadingScreen()
{
AsyncOperation async = Application.LoadLevelAsync("Main Scene");
while(!async.isDone)
{
loadingScreen.SetActive(true);
yield return null;
}
}
The loading screen has an animator attached to it which loads all the images so I'm not too sure why this isn't working, anyone any insight?
Comment
Try
IEnumerator DisplayLoadingScreen()
{
AsyncOperation async = Application.LoadLevelAsync("$$anonymous$$ain Scene");
yield return async;
}
This won't work as its not telling my Loading screen to be active at anytime.
You need to activate your Loading Screen every time when the async is not finished?
Ah right I see where you're co$$anonymous$$g from, I will try once I get home, thanks