Hi @unity_bill
In docs for memory management there is one section about unloading partially unload asset:
https://docs.unity3d.com/Packages/com.unity.addressables@1.2/manual/MemoryManagement.html
This case doesnt work for me. I cant unload only just one asset from memory. Even, Im making mirroring load-unload operation there is still reference to asset (in my case im trying load/unload Sprite). In detailed memory profile i got this ref (see screenshot).
Am I doing something wrong?
Loading two different sprites from same bundle:
Addressables.LoadAssetAsync<Sprite>("Assets/Sprites/A/element_fire.png").Completed += handle =>
{
_opCache.Add(handle);
image.sprite = handle.Result;
};
Addressables.LoadAssetAsync<Sprite>("Assets/Sprites/B/element_fire_1.png").Completed += handle =>
{
image2.sprite = handle.Result;
};
Trying unload only one sprite:
foreach (var sprite in _opCache)
{
Addressables.Release(sprite);
}
_opCache.Clear();
image.sprite = null;
Resources.UnloadUnusedAssets();
I found that reference staying inside of LRUCacheAllocationStrategy, as released operation with referenece to asset (m_Result). When I cleared result to null in ProviderOperation.Destroy() everythings works now. Can you please check/confirm this issue and suggest fix for that?