Release unused LocalizedAssets

Hi,

I am trying to release unused localized assets from memory in my appplication. Once loaded the asset would remain in memory (according to the Addressables Event Viewer), even when not in use.

I tried releasing the CurrentLoadingOperation of my LocalizedAsset instance, but it did not release the asset (Addr Event Viewer). Doing this did not seem to make any difference.

I also tried to keep a reference to the handle returned by LoadAssetAsync (on LocalizedAsset) and releasing this handle later on. This released the asset in the Event Viewer, but this also resulted in an Exception (“invalid operation handle”) when I tried to load the same asset again.

Is there an official way to release unused localized assets from memory?

Hi,
At the moment the AssetTable holds an internal AsyncOperation for each asset that has been requested previously.
We have added a ReleaseAssets method in the next release but this will release all the AsyncOperations in the table, not just a chosen 1.
It should be simple for us to add it. Ill add it to out tasks.
If you want to do it now you can change the AssetTable.cs file and make line 15 public instead of internal

internal AsyncOperationHandle? AsyncOperation { get; set; }

Now just get the entry from the table, if the operation is not null then release it and finally set it null so that it will be fetched correctly if you request it again in the future.