Loading bar async

Discussion and help for Easy Save 3

Loading bar async

Postby Alexandr Archer » Wed Aug 14, 2019 9:29 am

I have this coroutine. Can I add ES3 loading progress to this? Or muliple progresses to all of my loading Lists?

private IEnumerator LoadWithBar (AsyncOperation loading)
{
loadBar.gameObject.SetActive(true);
while (!loading.isDone)
{
loadBar.LoadVisualise(loading.progress);
yield return null;
}
loadBar.gameObject.SetActive(false);
}
Alexandr Archer
 
Posts: 2
Joined: Wed Aug 14, 2019 8:37 am

Re: Loading bar async

Postby Joel » Wed Aug 14, 2019 5:30 pm

Hi there,

ES3.Save calls run synchronously, and there's no way of determining how long a save or load will take (the time taken to write data to disk very much depends on what else is happening across the operating system).

However, if you are using multiple Save calls, you might be able to indicate your own progress. For example, this might look like this:

private IEnumerator LoadWithBar ()
{
loadBar.gameObject.SetActive(true);

ES3.Save<int>("myInt', 123);
loadBar.LoadVisualise(0.25f);
yield return null;

ES3.Save<int>("myInt', 123);
loadBar.LoadVisualise(0.5f);
yield return null;

ES3.Save<int>("myInt', 123);
loadBar.LoadVisualise(0.75f);
yield return null;

ES3.Save<int>("myInt', 123);
loadBar.LoadVisualise(1.0f);

loadBar.gameObject.SetActive(false);
}


Hope this helps!

All the best,
Joel
Joel Tebbett @ Moodkie Interactive
Twitter - Unity - LinkedIn
User avatar
Joel
Moodkie Staff
 
Posts: 2476
Joined: Wed Nov 07, 2012 10:32 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron