Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question Invalid path in TextDataProvider while using AssetBundle Provider

Discussion in 'Addressables' started by Nevrozelya, Feb 14, 2022.

  1. Nevrozelya

    Nevrozelya

    Joined:
    Aug 26, 2014
    Posts:
    5
    Hello everyone !

    I post today to request some help about Addressables. I'm trying to use them within a project, and I have troubles to set those up with Unity Cloud Builds.
    Here is what I did :
    - create a new project, import the Addressables (1.19.18) package through Package Manager
    - create an Addressables group with 5 sprites in it
    - set the "RemoteBuildPath" to "ServerData/[BuildTarget]" and the "RemoteLoadPath" to "MyS3ContainerUrl/[BuildTarget]"
    - my group contains my 5 sprites labeled as "customLabel", is set to use RemoteBuildPath and RemoteLoadPath, and has those parameters :
    Inlude in Build : true
    Bundle mode : Pack together
    Bundle naming mode : Append hash to filename
    Asset Provider : Assets from bundles provider
    Asset Bundle Provider : AssetBundleProvider
    - build the addressables via Unity > Addressables groups > build > New buid > Default build script
    - upload the .bundle, .hash and .json (catalog) files to my S3 container, with all rights set to public

    I writed a small script to try out my build. Eveything works fine in the editor (of course) and in a build that I make locally. But when I build with Cloud Build, I have this error : "System.Exception: Invalid path in TextDataProvider". The first thing I don't understand is : why am I having an error about "TextDataProvider" since I use "AssetBundle Provider" ?

    You can see below the full log, but Unity seems to be searching for StreamingAssets/aa/settings.json. The thing is, that file in not included in the final Windows64 build. So I searched for the file somewhere else, and I found it in my project /Library/com.unity.addressables/aa/Windows folder. And in there, I have two entries in the "m_CatalogLocations" array that have UnityEngine.ResourceManagement.ResourceProviders.TextDataProvider value for the "m_Provider" variable. Is it normal ?

    Here is the test script I'm using to test my build :

    Code (CSharp):
    1. public void Initialize()
    2. {
    3.     Debug.Log("assets service init");
    4.     _ = Test();
    5.     Debug.Log("assets service end");
    6. }
    7.  
    8.  
    9. private async Task Test()
    10. {
    11.     Debug.Log("test start");
    12.     string address = "customLabel";
    13.     AsyncOperationHandle<IResourceLocator> initOperation = Addressables.InitializeAsync();
    14.     IResourceLocator initResult = await initOperation.Task;
    15.  
    16.     Debug.Log("test continue");
    17.     AsyncOperationHandle<long> sizeOperation = Addressables.GetDownloadSizeAsync(address);
    18.     long dlSize = await sizeOperation.Task;
    19.     Debug.Log("download size : " + dlSize);
    20.  
    21.     AsyncOperationHandle downloadHandle = Addressables.DownloadDependenciesAsync(address);
    22.     Debug.Log("dl start " + downloadHandle.PercentComplete);
    23.     while (downloadHandle.PercentComplete < 1)
    24.     {
    25.         Debug.Log("dling : " + downloadHandle.PercentComplete);
    26.         await Task.Delay(10);
    27.     }
    28.     Debug.Log("ended " + downloadHandle.PercentComplete);
    29.  
    30.     //Addressables.Release(initOperation);
    31.     Addressables.Release(sizeOperation);
    32.     Addressables.Release(downloadHandle);
    33. }

    And here are the logs :


    assets service init
    test start
    System.Exception: Invalid path in TextDataProvider : '[PATH_TO_THE_BUILD]/Default Windows desktop 64-bit_Data/StreamingAssets/aa/settings.json'.
    Failed op : Resource<ResourceManagerRuntimeData>(settings.json)
    RuntimeData is null. Please ensure you have built the correct Player Content.
    Addressables - runtime data operation completed with status = Failed, result = .
    Addressables - Unable to load runtime data at location UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[[UnityEngine.AddressableAssets.Initialization.ResourceManagerRuntimeData, Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].
    OperationException : Addressables - Unable to load runtime data at location UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[[UnityEngine.AddressableAssets.Initialization.ResourceManagerRuntimeData, Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]].
    Failed op : InitializationOperation
    assets service end
    test continue
    UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=customLabel, Type=System.Object
    Failed op : CompletedOperation
    download size : 0
    UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=customLabel, Type=System.Object
    Failed op : CompletedOperation
    dl start 1
    ended 1
    assets ready, start
    rand: 0
    loading...
    UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=a367e568dcd742b46898933656cee91d, Type=UnityEngine.Sprite
    Failed op : CompletedOperation
    awaiting...
    affecting...
    ended


    I tried using another version of the package (starting with 1.18.19, which is the verified one at the moment I'm writing) and it didn't help.
    I also tried to disable the Library folder caching in Cloud builds, didn't help neither.

    Am I missing something ? I run out of solutions and things to try, and there are not much about this error on the internet...
    Thank you in advance for your help,
    Have a good day !

    PS : sorry for english mistakes, it's not my native language.
     
  2. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    Hi @Nevrozelya the TextDataProvider is one of the built-in providers used to load basic text files. This is used load the settings.json and catalog.json files, which are special files needed to initialize the Addressables system before you are able to load any AssetBundles.

    By default these files are created in the Library/com.unity.addressables/aa folder. When making a player build, these files are temporarily moved into the StreamingAssets folder so that they will be included in your game/app. If interested, you can see how this happens in AddressablesPlayerBuildProcessor.cs file.

    https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/Builds.html#build-artifacts

    There's a known bug at the moment where Addressables prematurely moves files in StreamingAssets back into the Library before the player build finishes, causing those "Invalid path" errors when running the application.

    One workaround is manually moving the Library/com.unity.addressables/aa folder to StreamingAssets before starting the player build. Or you can rebuild Addressables and try building the player again.
     
    WallerTheDeveloper and omg_peter like this.
  3. Nevrozelya

    Nevrozelya

    Joined:
    Aug 26, 2014
    Posts:
    5
    Hi @pillakirsten ! First of all, thank you for your answer !
    I'll try to include manually these 2 files to my streaming assets. In a production context, I guess I will try to implement a small editor script to update my streaming assets before any addressables build.
     
    pillakirsten likes this.
  4. Flow-Fire-Games

    Flow-Fire-Games

    Joined:
    Jun 11, 2015
    Posts:
    305
    Is there any news about this? Breaking the builds is kind of a big deal.
    We have this problem for the last days. It consistently started happening after a commit with 4 lines of code changed, a connection to any Addressable setting is not clear to us.
     
    User414322 likes this.
  5. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
    Hi @Flow-Fire-Games I just checked the status of the ticket, and it was marked as "won't fix". The reason being that issue as presented the submitted reproduction project was easily fixed by an editor restart.

    We're happy to reopen the case if a new bug report is submitted with a project that cannot fix the issue by an editor restart.
     
  6. Flow-Fire-Games

    Flow-Fire-Games

    Joined:
    Jun 11, 2015
    Posts:
    305
    I was able to track down a git commit with changes to addressable groups that introduced the issue for us.
    All the changes looked fine to me (inside Unity), we use binary serialization so I can't verify that for the actual file.
    Rolling this commit back "solved" the issue for us, at least for now.
    But the issue was very persistant. We use 3 machines for windows CLI building, all showed the same behavior (plus my development machine).
    Interesting to note is that we use 2020 LTS, I tried 2021 LTS and that worked fine.
    We want to upgrade to 21 very soon so hopefully this issue is not going to haunt us anymore.
     
  7. MadboyJames

    MadboyJames

    Joined:
    Oct 28, 2017
    Posts:
    262
    I've recently run into this problem as well. It only occurs during a cloud build (I'm using github actions) and while using an ubuntu server. If I use a windows server to build my project, then the issue is not present (however, FMOD is not in the build then).I copied Library/com.unity.addressables/aa into streamingAssets, but it seemed to have no effect. I am using Unity 2021.3.6f1.

    Any updates, fixes, or other workarounds for this?
     
  8. kogi_rc

    kogi_rc

    Joined:
    Apr 23, 2019
    Posts:
    39
    If you're not getting aa folder inside your build after a fresh vcs pull, you might want to check if you're using compatible packages. See my investigation here:

    https://forum.unity.com/threads/are...etsettingsdefaultobject.1317441/#post-8338311

    Addressables need to be at version 1.20.3 and Localization at 1.3.2.
     
    Last edited: Aug 12, 2022
  9. MadboyJames

    MadboyJames

    Joined:
    Oct 28, 2017
    Posts:
    262
    On local, addressables work fine and the aa folder is included in the build. The ubuntu cloud build lacks the aa folder and the windows cloud build lacks Master.bank for FMOD.

    I am not using localization, so that shouldn't be a factor. As for addressables, I am using version 1.19.19 and I do not see an update option in the package manager. I have enabled preview packages in case that was the issue. How can I get version 1.20.3?

    upload_2022-8-12_15-14-53.png

    I'm not sure how I can check if my packages are compatible. I read through your investigation, which, if I understand correctly, is depicting an interaction between Localization and Addressables which cause addressables to fail down the line. I could be experiencing something similar
     
  10. MadboyJames

    MadboyJames

    Joined:
    Oct 28, 2017
    Posts:
    262
    If I take the download artifact and place in it the aa folder generated locally... it works! ...Which isn't too surprising. Technically, I could have my CD pipe build the game on a windows and linux server, grab the aa file from the "windows built" artifact, place it in the "ubuntu-built" artifact and then output that complete artifact.

    Seeing as the windows server takes 3-5 times longer to build the game than ubuntu, I do not see this as a valid solution. kinda funny though.

    To clarify, I am building the game for windows 64, but due to cloud building I can choose whether a windows or linux machine is doing the building.
     
    Last edited: Aug 12, 2022
  11. kogi_rc

    kogi_rc

    Joined:
    Apr 23, 2019
    Posts:
    39
    Unfortunately it doesn't seem that it's the same interaction as mine but you can still go into YOUR_PROJECT/Packages/manifest.json to set
    "com.unity.addressables" to 1.20.3 to see if maybe it's some other bug that has been fixed already.

    Another idea is to check if you have custom preprocessor directives in your project. I had an issue once with a faulty build script that was building addressables without DEBUG compile conditional which silently failed because there was a compile-time error that wasn't present in DEBUG build. It normally should cause the build to fail for regular player build, too but I had a custom build script that set DEBUG flag too late (after the addressables has been built, before the regular player build). It was an oversight on my part but maybe it's something similar. For example addressables failing to build because UNITY_EDITOR_WIN is not set on the ubuntu machine.

    It's really a wild guess because there a quite a few ways addressables may fail to build silently because for some reason it doesn't stop a build as soon as it finds an error. The answer may be hidden somewhere in editor.log. Try looking for stack traces containing "AddressableAssetSettings:BuildPlayerContent".
     
    Last edited: Aug 12, 2022
  12. MadboyJames

    MadboyJames

    Joined:
    Oct 28, 2017
    Posts:
    262
    I'll look into that and get back to you. Thanks for the lead! that's a whole lot of direction I didn't have before.
     
  13. MadboyJames

    MadboyJames

    Joined:
    Oct 28, 2017
    Posts:
    262
    I think I found the culprit (or part of it):
    "Cannot recognize file type for entry located at 'Assets/Art/Textures/UniqueProjectilesVol1_8x8_4K.PNG'. Asset import failed for using an unsupported file type."

    I have popped over to this thread for further assistance.
    https://forum.unity.com/threads/unsupported-file-type.1006574/
     
  14. kogi_rc

    kogi_rc

    Joined:
    Apr 23, 2019
    Posts:
    39
    No obvious ideas come to my mind unfortuntaely. :/

    Another wild guess would be to check if it's maybe related to case sensitivity? Ubuntu likely uses case sensitive filesystem while windows doesn't. Maybe you have two versions of
    .png or .png.meta file in your source control or something like

    Assets/Art/Textures/UniqueProjectilesVol1_8x8_4K.PNG
    Assets/Art/Textures/UniqueProjectilesVol1_8x8_4K.png.meta

    which would probably work in Windows and maybe fail to pick up .meta file on Ubuntu and attempt recreate .meta with incompatible import settings. Not sure if it's releveant at all, maybe Unity has own logic to load assets regardless of case.
     
  15. MadboyJames

    MadboyJames

    Joined:
    Oct 28, 2017
    Posts:
    262
    I think that sounds likely. I tried changing the file extension from .PNG to .png and made sure the meta file name matched, but it had no effect. I looked in the .meta file, but couldn't find any reference to an associated file (aside from the meta file name being the same as its related asset)
     
  16. snowinrain

    snowinrain

    Joined:
    Jan 17, 2016
    Posts:
    15
    I encountered this issue today. Able to fix it with the following steps:
    1) Restart Unity Editor
    2) Clean Build - All Addressable (Optional)
    3) Build Addressable
    4) Build Windows Standalone.

    After build, checking <your_game>\<your_game>_Data\StreamingAssets, folder aa folder was there and everything worked as expected

    Thanks
     
  17. sajkowart

    sajkowart

    Joined:
    Oct 7, 2020
    Posts:
    16
    For future me...
    Even if first build succeded, it can happen.
    Check if file formats are imported correctly and there aren't ones that need reimport.
    Build again through addressables new Build > New build.
    Build output didn't need to be deleted.
    Happened after switching to android platform.