Since you are using the LoadAssetAsync api, you need to hold onto the AsyncOperationHandle instance so that you can pass it into the Release api. If you just use InstantiateAsync, then you should use ReleaseInstance instead of Destroy, and you won’t need to hold onto the handle.
Correct, i get that but i am not seeing any different behaviour, i have tried all variants.
I am going to just pull out the code into a small project and test it with an asset in isolation as a sanity check. If it is still occurring, i’ll follow up.
Hmm so yes, my test project is working fine with the above code, will have to do more investigation in the main project, thnx for confirming clean up code
Ok so i have everything working as discussed, the issue comes to LoadAssetsAsync ( note: s )…
This will only return back 1 AsyncOperationHandle
We use the LoadAssetsAsync to rapidly load in a folder of assets but we use the assets at various times. Unfortunately there is no way i can see to get a per AsyncOperationHandle per asset via this api so i can release individual assets?
The documentation states that you can release on the Result but again, for the entire handle this is fine but i don’t want to release all 100 objects, only a subset
If i revert back to LoadAssetAsync, it works, but it is about 10x slower to load in
What’s the expected behaviour to release assets independently when loaded via LoadAssetsAsync or is that not possible?
If not then is the expectation that i manually filter out what should be loaded / unloaded via this call and release in one go?
What does your code look like to load them individually? It shouldn’t be that much slower.
I’m honestly not sure. If what you say is true about passing handle.Result to Release, then I would assume that you can pass each loaded object into Release.
await Addressables.LoadAssetsAsync<UnityEngine.Object>(locDB, result => { // do somethin // ).Task;
I assume it’s just the fact it has to do more work per asset load vs some optimized path via LoadAssets
Unfortunately LoadAssetsAsync i don’t get an asyncHandle per object which i understand, so i have to group them together in a way to clean up the release later…