Search Unity

[1.5.0] Name 'Caching' does not exist

Discussion in 'Addressables' started by Greyborn, Dec 24, 2019.

  1. Greyborn

    Greyborn

    Joined:
    May 26, 2016
    Posts:
    61
    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).
     
    KarolStolaDD and Glaswyll like this.
  2. Glaswyll

    Glaswyll

    Joined:
    Feb 13, 2014
    Posts:
    103
    We're also seeing this error.
     
    Last edited: Dec 25, 2019
  3. KarolStolaDD

    KarolStolaDD

    Joined:
    Sep 10, 2019
    Posts:
    7
    Same here.
     
  4. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    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.
     
    Greyborn likes this.
  5. jiannis_hs

    jiannis_hs

    Joined:
    Apr 26, 2016
    Posts:
    12
    Can you please release this hotfix sooner than later, this bug is preventing us from using the latest version in our project.
     
  6. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    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.
     
    Glaswyll likes this.
  7. Joshdbb

    Joshdbb

    Joined:
    Oct 28, 2014
    Posts:
    50
    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):
    Code (CSharp):
    1.  
    2. internal void ClearDependencyCacheForKey(object key)
    3. {
    4. #if !UNITY_SWITCH
    5.     IList<IResourceLocation> locations;
    6.     if (key is IResourceLocation && (key as IResourceLocation).HasDependencies)
    7.     {
    8.         foreach (var dep in (key as IResourceLocation).Dependencies)
    9.             Caching.ClearAllCachedVersions(Path.GetFileName(dep.InternalId));
    10.     }
    11.     else if (GetResourceLocations(key, typeof(object), out locations))
    12.     {
    13.         foreach (var loc in locations)
    14.         {
    15.             if (loc.HasDependencies)
    16.             {
    17.                 foreach (var dep in loc.Dependencies)
    18.                     Caching.ClearAllCachedVersions(Path.GetFileName(dep.InternalId));
    19.             }
    20.         }
    21.     }
    22. #endif
    23. }
    24.  
     
  8. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    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.)
     
    Joshdbb likes this.