How to reset cached evaluated {path} of Addressable?

Currently my load path for externally exported Addressables packages is set to

{MapLevel.CurrentMapPath}/UnityData/[BuildTarget]

For ex. this code:

MapLevel.CurrentMapPath = "something";
var catalogPath = myPathHere;
Addressables.LoadContentCatalogAsync( catalogPath ).Completed += obj =>
{
    if ( obj.Result != null )
    {
        Addressables.AddResourceLocator( obj.Result );
        foreach ( var item in obj.Result.Keys )
        {
            //handling resources here
        }
        Addressables.RemoveResourceLocator( obj.Result );
    }
    Addressables.Release( obj );
};

Works fine until I run it again with different package. If on the 2nd run I change MapLevel.CurrentMapPath = "something2";
then do for ex. Addressables.LoadAssetAsync<SomeObject>( item ) the MapLevel.CurrentMapPath is still evaluated (or cached?) to old "“something” and I get wrong path and missing file exception. How do I remove cached value and reevaluate {MapLevel.CurrentMapPath}?

Nvm found it using search all files using notepad++
UnityEngine.AddressableAssets.Initialization.AddressablesRuntimeProperties.ClearCachedPropertyValues();

Also in docs:
https://docs.unity3d.com/Packages/com.unity.addressables@1.5/api/UnityEngine.AddressableAssets.Initialization.AddressablesRuntimeProperties.html#UnityEngine_AddressableAssets_Initialization_AddressablesRuntimeProperties_ClearCachedPropertyValues

2 Likes