Search Unity

Bug Addressables not loading in build

Discussion in 'Addressables' started by LuGus-Jan, Jul 5, 2020.

Thread Status:
Not open for further replies.
  1. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    Unity: 2018.4.23f1
    Addressables v 1.11.2
    Platform: Macos 10.15.5

    When attempting to initialize Addressables in build, I'm confronted with the following error messages:

    In editor everything works fine. This includes running using the 'Use Asset Database (Fastest)' and 'Use Existing Build (requires built groups)'. The groups for the editor and the player build are both built using the 'Default' profile, and I can see the bundles and additional files in the build (see attached screenshot).

    The contents of the 'settings.json' file reads as follows:

    So everything pretty standard. I'm a bit puzzled to what is happening exactly. Anyone that could help shed some light on this?

    Thanks in advance!
     

    Attached Files:

    JesseSTG likes this.
  2. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    Bump & small update on this...

    I get mixed success in initializing Addressables.
    Addressables.InitializeAsync()
    works ±1/40th of the time when a build is produced, for example, I produce a minimal build with just 1 group enabled for the build, it works. I create a second one with more groups enabled, it works. I make a third one, no changes, it no longer works and all coming after that don't work.

    Since Addressables in 1.11.2 don't trigger any exceptions anymore and merely log them, I can't hook in into my debugger, I downgraded to 1.8.3 (the version on which I picked up on Addressables), and traced the issue to some value being null in the initialization process.

    Screenshot 2020-07-07 at 23.32.54.png

    I haven't been able to produce a minimal reproducible scenario (I tried to setup minimal scenes, resources and prefabs groups etc, but they all load fine...). So any help on this would be greatly appreciated.

    What I'm mainly looking for is a reason why
    m_RtdOp.Result
    could be null... I assume that something similar is going wrong in 1.11.2.

    Thanks in advance.
     
  3. joe_nk

    joe_nk

    Joined:
    Jan 6, 2017
    Posts:
    67
    Just wanted to jump in here to let you know I'm getting the exact same issue, with:

    Unity: 2019.4.1f1
    Addressables v 1.11.2
    Platform: Macos 10.15.5


    It's the end of my day here, but I'll see what I can dig up with this tomorrow. might be worth noting that our other platforms are building and running ok (windows standalone, iOS, Android) so not sure what's going on here
     
  4. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    @joe_nk 'Glad' to hear someone else is running into the same issue. My primary machine is a mac, so I've been exclusively been testing on this. At work, I had a Windows machine at my disposal, and whatever we do, it doesn't seem to be happen there. So it re-affirms my and your assumption that it is mac-specific.
     
  5. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    I filed a bug report, ID: 1261896

    Not sure if tagging like this is allowed, my apologies if not: @unity_bill, @DavidUnity3d
     
    Last edited by a moderator: Jul 21, 2020
  6. joe_nk

    joe_nk

    Joined:
    Jan 6, 2017
    Posts:
    67
    So I've been digging and this appears to be the issue:

    BuildScriptFastMode stores the path to the addressable assets settings file into your player prefs like so:

    Code (CSharp):
    1. PlayerPrefs.SetString(Addressables.kAddressablesRuntimeDataPath, $"GUID:{guid}");
    These player prefs then persist and are used when initialising a standalone player here:

    Code (CSharp):
    1. public AsyncOperationHandle<IResourceLocator> InitializeAsync()
    2. {
    3.     return InitializeAsync(ResolveInternalId(PlayerPrefs.GetString(Addressables.kAddressablesRuntimeDataPath, RuntimePath + "/settings.json")));
    4. }
    If you change the above block in AddressablesImpl.cs to this:

    Code (CSharp):
    1. public AsyncOperationHandle<IResourceLocator> InitializeAsync()
    2. {
    3.     return InitializeAsync(ResolveInternalId(RuntimePath + "/settings.json"));
    4. }
    it should work. I'm not sure if this is intentional, @unity_bill perhaps PlayerPrefs should be avoided, if not an editor build?

    Instead of modifying the addressables code, you could also add a build step that clears this PlayerPrefs value so that you can run the build on the same machine you're developing on
     
    CameronND, sadambober and LuGus-Jan like this.
  7. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    I want to confirm that this fixed it for me indeed. Thanks @joe-nk for digging through this one!
     
    joe_nk likes this.
  8. CameronND

    CameronND

    Joined:
    Oct 2, 2018
    Posts:
    89
    I got this error too, thanks for the solution.
    Addressables is so frustrating. Every update fixes something but then breaks something else.
     
  9. Zarkend

    Zarkend

    Joined:
    May 11, 2016
    Posts:
    28
    Same here.

    Addressables v 1.15.1
    Unity 2019.4.8f1
    Android
     
  10. Alvarden

    Alvarden

    Joined:
    Feb 22, 2019
    Posts:
    61
    I have the same problem here, and no, i could find what @joe-nk showed, it only shows the PlayerPrefs, but not the other part, so i can't apply your solution, unfortunately.

    Unity: 2019.4.8f1
    Addressables v 1.8.5
    Platform: Android
     
  11. joe_nk

    joe_nk

    Joined:
    Jan 6, 2017
    Posts:
    67
    This has been fixed, I think in in v1.15.1? If you can't upgrade, call early on, before doing anything with the Addressables API:

    Code (CSharp):
    1. #if !UNITY_EDITOR
    2. PlayerPrefs.DeleteKey(Addressables.kAddressablesRuntimeDataPath);
    3. #endif
     
  12. Alvarden

    Alvarden

    Joined:
    Feb 22, 2019
    Posts:
    61
    Yeah, i just tested that alternative, but the addressables are still missing on build. It seems i'll have to upgrade to see if that solves the problem (good thing i made a backup just in case).

    Update: I upgraded the Addressables to 1.16, but the problem still persists in all Play Mode Scripts. @joe_nk not sure if there is another alternative for that version or i can apply that same solution one way or another.

    Just in case, i'm showing the other assets i'm using for my project, in case someone wants to tell me if there is a incompatibility or extra change i have to do:
    • Amplify Color
    • SimpleInput
    • DOTween
    • Unity UI Extensions
    • AdjustPivot
    • Save Game Gold
    Update 2: Yeah, i just gave up and started to use another alternative. I'm probably one of the unfortunate one who got a breaking bug on Addressables and i can't use it anymore (at least, for my current project).
     
    Last edited: Oct 8, 2020
  13. Zarkend

    Zarkend

    Joined:
    May 11, 2016
    Posts:
    28
    Happened to me again with :

    Addressables v 1.16.1
    Unity 2019.4.8f1
    Android
     
    msfredb7 likes this.
  14. kailashvetal47

    kailashvetal47

    Joined:
    Oct 15, 2014
    Posts:
    7
    I can confirm it Happens on windows machine also.

    Unity Version 2018.4.28f1
    Addressable version: 1.16.6
     
  15. kailashvetal47

    kailashvetal47

    Joined:
    Oct 15, 2014
    Posts:
    7
    Adding the above lines at Start() function before anything does not solve the issue and still gives the same error in the build.
    Unity Version 2018.4.28f1
    Addressable version: 1.16.6
     
  16. allenWTF

    allenWTF

    Joined:
    Mar 16, 2018
    Posts:
    8
    Did anybody solve this issue? I have it in my WebGL build and I'm not sure what to do because i have iOS build, for example, and it works just fine.

    Addressables v 1.16.7
    Unity 2018.4.26f1
    WebGL
     
  17. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    I'll flag this with the team, and relay any updates they have.
     
  18. allenWTF

    allenWTF

    Joined:
    Mar 16, 2018
    Posts:
    8
    Well, in case of WebGL the problem was that I wasn't hosting my build on local server. I was just launching it through file:/// path. Hosting my build on local server and running it through localhost helped to load addressables without any errors.
     
  19. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    Team definitely thinks there is a bug in there somewhere. They are having a look.
     
    Alvarden and kailashvetal47 like this.
  20. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    472
    blocked on this; I get it when trying to run an exported project from 2019.4.13f1 in Android Studio 4.1.1 (addressables 1.16)
     
  21. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    I just noticed my game project is having this issue as well. My addressable prefabs are not loading in properly in an actual game build.

    Any update on this?
     
  22. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    This is actively being looked into, but a fix should be coming in one of the upcoming releases.
     
    xifeng8445 and Velo222 like this.
  23. nomadic

    nomadic

    Joined:
    Mar 4, 2010
    Posts:
    44
    Same problem. Deleting the PlayerPref has not worked for me.

    Unity 2019.4.17f1
    Addressables 1.16.15
    Build Platform: Windows
     
  24. panadero99

    panadero99

    Joined:
    Oct 3, 2019
    Posts:
    7
    If more information helps any, I'm also encountering this.

    Developing on:
    Windows 10
    Addressables: 1.16.15
    Unity 2020.2.1f1

    Building for:
    Linux (Mono)

    My Ubuntu 19.04 and a friend's Manjaro installation both fail to run correctly, with the error messages mentioned above in both of our Player.log files.
     
  25. AccessGame

    AccessGame

    Joined:
    Oct 26, 2020
    Posts:
    2
    Same for me.
    Developing on:
    Windows 10
    Addressables: 1.16.15
    Unity 2020.2.1f1

    And there is a SBP Error.
    Build Task GenerateSubAssetPathMaps failed with exception:
    Index was out of range. Must be non-negative and less than the size of the collection
     
  26. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
    Fix should be rolling out soon, possibly in the next release. Stay tuned.
     
    Alvarden and HLSeanStevens like this.
  27. The-Doctor111929

    The-Doctor111929

    Joined:
    Aug 11, 2020
    Posts:
    1
    Getting the same problem.

    Developing on: Windows 10
    Addressables: 1.16.15
    Unity 2020.1.1f1

    Works on Android, iOS and Windows, but my WebGL build no longer initializes correctly. I was on 1.8.5 and everything was working fine, but upgraded due to another issue I was having with addressables. Since then, I've had some linker issues (which have been resolved on a separate thread through the use of a link.xml file), but have since run into this issue.
     
  28. ClpsPLUG

    ClpsPLUG

    Joined:
    Apr 16, 2017
    Posts:
    13
    Is Issue ID ADDR-1688 related to this thread? I indeed call LoadAssetAsync in an async context (via UniTask,) and getting the same error message. Due to the heavy usage of the async context in my current project, I cannot switch back to Unity-native async handling.

    The weird property of intermittence is there as well; if I cause a recompile by changing the scripts and build it (while keeping the use of LoadAssetAsync in async contexts,) the error goes away in some cases. If a built player encounters this error, I'll get the same error every build after that until I force a recompile.

    FYI, I'm developing on:
    macOS Catalina 10.15.7
    Addressables version 1.16.15
    Unity 2020.2.1f1
     
  29. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    As for the main issue in this thread, we think we've fixed this is 1.17.2-preview. If you'd like to update to that version and give it a try that'd be great. Let us know if there's still any issues.

    @ClpsPLUG I don't think that is related to this thread. It looks like our QA closed 1688 as "not a bug". If you're seeing an issue that looks similar to what's described in 1688 then please file a bug with a good repro project and we can have a look.
     
  30. panadero99

    panadero99

    Joined:
    Oct 3, 2019
    Posts:
    7
    Unless I'm doing something wrong, it doesn't seem to be fixed for me. Same issue as before, including the same errors in player.log. I don't have Unity installed on my Mac Mini, so I'm building for macOS on my Windows Unity, copying the build directory over to the Mini, and running from there. The game will start, but once it tries to access an addressable object, it will freeze and I have to force quit.

    Is there anything else I should be doing before (or as part of) the build process?
     
  31. Redmarian

    Redmarian

    Joined:
    Jul 6, 2017
    Posts:
    8
    I'm having the same issue and it was already the case with the previous version. I migrated to 1.16.15, and I hope for a resolution soon enough.
     
  32. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    @panadero99 Hm.. Just curious, if you use the fix that @joe_nk posted does that work for you then? And just double checking, you're on 1.17.2-preview?

    @Redmarian We think we've fixed it in 1.17.2-preview. Give that a try and see if it fixes your problem. Feel free to post on here or file a bug (or both) if you're still experiencing issues.
     
  33. panadero99

    panadero99

    Joined:
    Oct 3, 2019
    Posts:
    7
    @davidla_unity I just tried and unfortunately it still doesn't work. I have a preload script that runs before my first scene in the game, and on the Awake function, before I load the title screen scene, I added the code from @joe_nk 's post

    Code (CSharp):
    1. #if !UNITY_EDITOR
    2. PlayerPrefs.DeleteKey(Addressables.kAddressablesRuntimeDataPath);
    3. #endif
    and I confirmed I'm on 1.17.2-preview. The results were the same. If it helps any, Windows builds I've done have continued to work through all of this experimentation. The very first time I started attempting to build for macOS and Linux was while this bug was active, so I've never had any working builds for those platforms.
     
  34. panadero99

    panadero99

    Joined:
    Oct 3, 2019
    Posts:
    7
    Actually I just noticed something that might give me a direction to look at. Stand by.

    Edit: False alarm. Still not working. There's just no StreamingAssets folder being created so things are failing looking for StreamingAssets/aa/settings.json
     
    Last edited: Jan 27, 2021
    JesseSTG likes this.
  35. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    Same here; StreamingAssets just isn't being created.
     
  36. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    184
    Having this all new problem in 1.16.16.

    My loading code has worked for months, since 1.11
    I can't create a repro project. I tried for over 6 hours today just trying to create a repro but I can't get it to fail.

    It fails every time in my project, across 4 different machines and 3 different build targets.
    I downgraded to 1.16.15 and my code works again. Works now again on all my machines and build targets.

    Weirdly, on Windows, on 1.16.16, everything works when I do "Build and Run"
    However once I quit the game, and try to run the .exe generated from the "Build and Run" it does not work. Very strange.

    I think it has something to do with the Addressables system not being initialized in time. On console device, I got it to fail several times in my repro (not consistently). I would just rebuild, not having touched anything. The error wasn't very helpful, but it's a MissingMethod.
     
  37. euphrates

    euphrates

    Joined:
    Nov 28, 2013
    Posts:
    1
    Had the same problem for the configuration below but finally resolved it with @davidla_unity 's suggestion (migrating to Addressable version '1.17.2-preview'), well at least I got rid of the errors while initializing Addressables in build. One thing that is extra (I do not know if it has any effects on it though) for me, I have updated localization version to '0.10.0-preview'.

    Developing on:
    Mac OS Big sur
    Addressables: 1.16.15
    Unity 2020.2.1f1

    Building for:
    Android

    Though the build errors are gone my localization string database is still unable to load during the app startup but I assume that is another issue.

    Update: Do not forget to Reimport addressable and localization assets after the version updates. To solve my second issue of the localization string database not loading for Android, I have applied what is suggested in the following thread and it fully works now.
    https://forum.unity.com/threads/how-to-have-my-translations-working-again.1046671/#post-6771778
     
    Last edited: Jan 28, 2021
  38. panadero99

    panadero99

    Joined:
    Oct 3, 2019
    Posts:
    7
    I am pretty religious about rebuilding my addressables so I made sure to do that after updating to 1.17.2-preview. I'm completely lost at this point.
     
  39. twocool

    twocool

    Joined:
    Jan 16, 2014
    Posts:
    17
    Same error thrown for me in 1.17.2-Preview.

    Update: I upgraded to 1.17.4-Preview. It is now working for Standalone. I'm going to try building on Android.

    Update: Works in Android build but seems to be a delay before asset is loaded.
     
    Last edited: Jan 29, 2021
  40. panadero99

    panadero99

    Joined:
    Oct 3, 2019
    Posts:
    7
    I upgraded to 1.17.4-Preview and my macOS build is successful! Later today I'll try a Linux build, but I have a working game on an M1 Mac Mini as of today.
     
  41. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    Did you update it the usual way? The patch isn't yet listed on my Package Manager window.
     
  42. panadero99

    panadero99

    Joined:
    Oct 3, 2019
    Posts:
    7
    @JesseSTG Yes. I have preview packages enabled in the package manager and after seeing twocool's post, I checked and saw it available to download. I also made sure to rebuild the addressables as euphrates mentioned, after updating. If you're not seeing it the new version, my only guess is some sort of staged rollout and you'll hopefully see it soon.
     
    JesseSTG likes this.
  43. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    Still not seeing the new version on the package manager window. However, I manually set the version in my manifest.json to 1.17.4-preview and installed it successfully.

    EDIT: I still get this issue.
     
    Last edited: Jan 30, 2021
  44. Kozaki2

    Kozaki2

    Joined:
    Apr 8, 2019
    Posts:
    47
    Hi, I just upgraded addressables to 1.17.4-preview and build is successfull but on my android device I have errors

    2021.01.30 22:29:51.133 30824 30861 Error Unity Exception encountered in operation Resource<IAssetBundleResource>(Android\localization-locales_assets_all.bundle), status=Failed, result= : Invalid path in AssetBundleProvider: 'Library/com.unity.addressables/aa/Android/Android\localization-locales_assets_all.bundle'.
     
  45. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I am having the same problem. It works in Editor, and Build And Run option, but not Build and then trying to run it off the disk.

    But I am using Unity 2021.10b4 and the package manager does not allow me to select 1.17.4... even after enabling the pre-release package option.
     
  46. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I manually edited the manifest to update to 1.17.4, but having the same issue as @sameng , only works for Editor and Build and Run, but not Build and then run it after wards.
     
  47. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I can confirm that downgrading to 1.16.15 worked again. So it is definitely Addressable problem after 1.16.15
     
  48. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    184
    I have a suspicion that it's something to do with the Scriptable Build Pipeline.

    The dependency for
    Addressables 1.16.15 requires SBP 1.15.1, and
    Addressables 1.16.16 requires SBP 1.15.2

    Looks like SBP 1.16.1 is now released. Maybe that will solve the issue? I don't have time to dedicate to this, but wanted to give my theory, given that the release notes for Addressables 1.16.16 seems to only fix a "test case" I suspect it's SBP actually breaking under the hood.

    It's also not a runtime/code bug, as I can copy/paste the StreamingAssets folder from a working 1.16.15 build to a non-working 1.16.16 build, and it works.

    So there's something wrong with the actual StreamingAssets addressables built assetbundles/catalog file, maybe?
     
    castor76 and JesseSTG like this.
  49. Kozaki2

    Kozaki2

    Joined:
    Apr 8, 2019
    Posts:
    47
    You're right. I can confirm that downgrade addressables to 1.16.15 works
     
  50. Redmarian

    Redmarian

    Joined:
    Jul 6, 2017
    Posts:
    8
    I have the same problem as @JesseSTG, I can't find a proper way to install the 1.17.4-preview version and just replacing the version in the json doesn't work.

    If it helps, it reads this:


    Code (JavaScript):
    1. {
    2.   "name": "com.unity.addressables",
    3.   "displayName": "Addressables",
    4.   "version": "1.16.16",
    5.   "unity": "2018.4",
    6.   "description": "The Addressable Asset System allows the developer to ask for an asset via its address. Once an asset (e.g. a prefab) is marked \"addressable\", it generates an address which can be called from anywhere. Wherever the asset resides (local or remote), the system will locate it and its dependencies, then return it.\n\nUse 'Window->Asset Management->Addressables' to begin working with the system.\n\nAddressables use asynchronous loading to support loading from any location with any collection of dependencies. Whether you have been using direct references, traditional asset bundles, or Resource folders, addressables provide a simpler way to make your game more dynamic. Addressables simultaneously opens up the world of asset bundles while managing all the complexity.\n\nFor usage samples, see github.com/Unity-Technologies/Addressables-Sample",
    7.   "keywords": [
    8.     "asset",
    9.     "resources",
    10.     "bundle",
    11.     "bundles",
    12.     "assetbundles"
    13.   ],
    14.   "dependencies": {
    15.     "com.unity.scriptablebuildpipeline": "1.15.2",
    16.     "com.unity.modules.assetbundle": "1.0.0",
    17.     "com.unity.modules.unitywebrequest": "1.0.0",
    18.     "com.unity.modules.unitywebrequestassetbundle": "1.0.0"
    19.   },
    20.   "repository": {
    21.     "url": "https://github.cds.internal.unity3d.com/unity/Addressables.git",
    22.     "type": "git",
    23.     "revision": "c238142d6dd78f465fa645cb6b4671ab3472ec99"
    24.   },
    25.   "upmCi": {
    26.     "footprint": "86de4a0cb6b2b8d4652802e07f1c5b0bea2d0426"
    27.   }
    28. }
     
Thread Status:
Not open for further replies.