//**addressables: fix: otherwise after DownloadDependencies().Complete += op => Addressables.Release we cannot load assets from remote bundle (via CreateWebRequest) with error:
// "The AssetBundle '***' can't be loaded because another AssetBundle with the same files is already loaded."
GetAssetBundle();
Without fix - download dependencies, free download deps-operation and try to load/use bundle again:
“The AssetBundle ‘http://localhost:55555/ui_misc_assets_all.bundle’ can’t be loaded because another AssetBundle with the same files is already loaded.” will be on 3rd step.
{
Debug.Log("1. start pre-download deps without usage");
var op = Addressables.DownloadDependenciesAsync("skins/BigSkin_Rok_Ninja");
yield return op;
Debug.Assert(op.OperationException == null);
Debug.Log("2. release pre-download operation");
Addressables.ResourceManager.Release(op);
}
{
Debug.Log("3. start asset usage");
var op = Addressables.LoadAssetAsync<Texture>("skins/BigSkin_Rok_Ninja");
yield return op;
Debug.Assert(op.Result != null);
Debug.Log("finished successfully");
}
Addressables.ResourceManager.Release(op) is obligatory:
Otherwise you cannot try download-deps later after fail (the same handle with OperationException is returned from the cache)
I don’t want to keep hundreds of bundles opened during theirs preloading.
It sounds like we have a bug in our download dependencies code. That code should not be loading a bundle at all. So if your fix is to just be sure to unload it during a release, then you’ve identified a problem, but not quite the right solution. Maybe we even have two bugs. One, we load a bundle. Two, we don’t clean up the AsyncOperation properly. We’ll look into it.