Page 1 of 1

Loading bar async

Posted: Wed Aug 14, 2019 9:29 am
by Alexandr Archer
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);
}

Re: Loading bar async

Posted: Wed Aug 14, 2019 5:30 pm
by Joel
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