Search Unity

[Bug] Addressables adding to "Built In Data/Resources" resources from editor folders

Discussion in 'Addressables' started by dwit_mass_creation, Aug 23, 2019.

Thread Status:
Not open for further replies.
  1. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    Currently (Addressables 1.1.9) in asset "Built In Data/Resources" are resources from all folders with "Resources" folder in path.
    So there are added resources from editor folders (for example "Editor/Resources/") and from WebPlayerTemplates folder.

    It shouldn't added these folders. I fixed it locally in AddressableAssetEntry.cs adding excluded paths, but I think it's bug.
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    What exactly do you mean? That they show up in the GUI? They won't be loadable via the Addressables API (due to the guard you found in AddressableAssetEntry.cs). Just trying to see what you mean by "there are added resources"
     
  3. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    972
    If I'm understanding him correctly, he's referring so something I run into as well. GatherAllAssets() returns Editor resources and even things in the "resources" folder in iOS/MacOS .bundle folders from native plugins. As a result, they end up in all sorts of places they should't be, even if they are stripped out further along the line later. I have worked around this with the following in AddressableAssetEntry::GatherAllAssets():

    Code (CSharp):
    1.  
    2. else if (guid == ResourcesName)
    3. {
    4.     foreach (var resourcesDir in Directory.GetDirectories("Assets", "Resources", SearchOption.AllDirectories))
    5.     {
    6. ++  if (resourcesDir.Contains("Editor") || resourcesDir.Contains(".bundle"))
    7. ++  {
    8. ++      continue;
    9. ++  }
    10.  
    I forgot to submit a bug for this... Ooops!
     
  4. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    So are you saying that these editor resources won't be included in build even if they are on list? I don't think they are included too.
    But will these editor asset entries (paths etc) be included in build?
     
  5. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    972
    Frankly, this was a late night discovery and workaround, while working on something else, so I cannot really remember!
     
  6. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    during build, we filter out all Editor things. Our logic flow is roughly this:

    Code (CSharp):
    1. if(thing in Resources)
    2.     if(not an editor thing)
    3.         add the location to our catalog to load via Resources.
    4. if(addressable asset)
    5.     if(not an editor thing)
    6.         add asset to some bundle somewhere
    7.         add the location to our catalog to load from the bundle.
    So for Resources, we don't actually control if the asset itself is in the build (which editor items shouldn't be), we just exclude the location from the catalog.
     
  7. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    And what about Resources directories in WebPlayerTemplates directory? Scripts in this directory are not compiled. Are Resources added to build?
     
  8. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Honestly, I don't know. If the folder is special and excluded from compiling, then Resources hopefully knows not to build it.
    Addressables is totally disconnected from what in Resources actually ends up in the build. All we do is look for what we think will be in the build, and add a named item to our catalog so you can load it. We don't make any Resources items be included or excluded from the build.
     
    jperry_oddgames likes this.
  9. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    Ok. Thanks for info.
     
Thread Status:
Not open for further replies.