Is it currently possible to say: load 100 items each frame?
(Assume they are all local and we just want to load them gently.)
(The “Completed” callbacks aren’t IEnumerator or async, so we can’t really say “await” or “yield” until next frame.)
Is it currently possible to say: load 100 items each frame?
(Assume they are all local and we just want to load them gently.)
(The “Completed” callbacks aren’t IEnumerator or async, so we can’t really say “await” or “yield” until next frame.)
All loading operations are async, you have no control over this at the moment. However, you can load in batches of any size you want.
True, I can more thinking in terms of:
var prefabOp = await Addressables.LoadAssets<GameObject>(
label.labelString, async (op) => { await something(); }
);
But because InvokeCompletionEvent in AsyncOperationBase isn’t async, there isn’t much we can do to pause the load via callback.
Batch the keys you want to load and use
Addressable.LoadAssets<GameObject>(batch1);
...
Addressable.LoadAssets<GameObject>(batchN);
It is up to you to write the managing class for that, but it is rather straight forward. If you need no logic even a Coroutine with a
yield return null
between each loop will do the job.
In theory, yes, it’s possible to split LoadAssets manually. But in practice I find we have a few labels, and the game actually doesn’t know how many items are under a certain label.
Currently Addressable will try to load as much as possible without throttling, is that correct?
That is correct. As far as I know LoadAssets should work. Without testing it, this should give you the locations of the actual assets instead, which you then can split/group into batches and then load batch by batch.
I would assume this works for labels just as it does for keys, as a label is just a key.
unity_bill has explained an something like this and I expect (and hope) the actual API for that to be cleaned up and made more obvious (rather than a generic type…). You will have to search this sub forum for his posts and will likely find it.
Thx, I think this is doable now, so I can load all the IResourceLocation associated with a label, put them in bucket, and then Load them in batch.