[1.5.0] Name 'Caching' does not exist

We just tried upgrading our project to use v1.5.0 and ran into the following issue when clearing all build caches through the Addressables UI and then trying to make a new build/bundles:

Library\PackageCache\com.unity.addressables@1.5.0\Runtime\AddressablesImpl.cs(811,21): error CS0103: The name 'Caching' does not exist in the current context

Reverting back to v1.4.0 fixed the issue for us (Unity 2018.4.13f1).

2 Likes

We’re also seeing this error.

Same here.

Yeah we added an API that uses the engine caching and missed adding scripting define blocks to prevent compilation errors for platforms that don’t support caching. The fix is already merged into our master branch and will definitely be part of the next release. However, we may be issuing a hot fix for this sooner.

1 Like

Can you please release this hotfix sooner than later, this bug is preventing us from using the latest version in our project.

I can’t give an exact day but we did decide to release a hotfix. Currently it looks like it’ll be 1.5.1 and should be released in a couple days.

1 Like

I have hit this issue as well. Unfortunately I have had to make some modifications to the addressables package to fix a different issue that I was having with synchronous addressable groups, so updating won’t be simple.

I have attempted to fix this issue myself by wrapping the contents of the ‘ClearDependencyCacheForKey’ function in a ‘#if !UNITY_SWITCH’ block.

This has fixed the build errors that I was seeing but I don’t know if I may be causing more issues by doing things this way. There may be other bits of code that I should be surrounding in a similar block.

Any advice would be much appreciated.

This is what the function now looks like (just to be clear):

internal void ClearDependencyCacheForKey(object key)
{
#if !UNITY_SWITCH
    IList<IResourceLocation> locations;
    if (key is IResourceLocation && (key as IResourceLocation).HasDependencies)
    {
        foreach (var dep in (key as IResourceLocation).Dependencies)
            Caching.ClearAllCachedVersions(Path.GetFileName(dep.InternalId));
    }
    else if (GetResourceLocations(key, typeof(object), out locations))
    {
        foreach (var loc in locations)
        {
            if (loc.HasDependencies)
            {
                foreach (var dep in loc.Dependencies)
                    Caching.ClearAllCachedVersions(Path.GetFileName(dep.InternalId));
            }
        }
    }
#endif
}

Hey @Joshdbb if that works for you then you should be good. Switch doesn’t support the use of caching so it should be fine. You may run into an issue doing a player build for Switch only because some Addressables tests may also need a similar define.

The official fix to this should be available now in 1.5.1. We basically do what @Joshdbb but with the #if !ENABLE_CACHING so we can be sure to remove all platforms that don’t support Caching (Switch, PS4, etc.)

1 Like