This is a bit more obscure, but it's something I'm constantly having to work around. I'm loading assetbundles, clothes, audio, etc. from script, but SuperController.singleton.isLoading is not a reliable method of determining if things are loading. I am doing things like the code shown below in the hopes of finding the right finished loading time, but it's a bit hackey and I'm not sure if it will work in all situations. It would be great if there were a function to call that accurately stated whether or not everything that was requested to be load, was finished loading.
Alternatively if yield return could work in all situations that would be an alternative.
For example this works:
yield return SuperController.singleton.AddAtomByType();
but loading presets, clothes, etc. we can't tell when they (and the associated textures) are done loading.
//my hack
//hopefully enough delay to finish loading
for (int i = 0; i < 30; i++)
{
yield return new WaitForEndOfFrame();
while (SuperController.singleton.isLoading)
{
yield return new WaitForSeconds(0.1f);
}
}
Alternatively if yield return could work in all situations that would be an alternative.
For example this works:
yield return SuperController.singleton.AddAtomByType();
but loading presets, clothes, etc. we can't tell when they (and the associated textures) are done loading.
//my hack
//hopefully enough delay to finish loading
for (int i = 0; i < 30; i++)
{
yield return new WaitForEndOfFrame();
while (SuperController.singleton.isLoading)
{
yield return new WaitForSeconds(0.1f);
}
}