Search Unity

Resolved Build Task GenerateSubAssetPathMaps failed with exception

Discussion in 'Addressables' started by JesseSTG, Jan 28, 2021.

  1. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    When I try to build my project's AssetBundles via Addressables (version 1.17.2-preview) I get this exception:

    Code (csharp):
    1. Build Task GenerateSubAssetPathMaps failed with exception:
    2. Index was out of range. Must be non-negative and less than the size of the collection.
    3. Parameter name: index
    4.   at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <9577ac7a62ef43179789031239ba8798>:0
    5.   at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <9577ac7a62ef43179789031239ba8798>:0
    6.   at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <9577ac7a62ef43179789031239ba8798>:0
    7.   at UnityEditor.Build.Pipeline.Utilities.ExtensionMethods.Swap[T] (System.Collections.Generic.IList`1[T] list, System.Int32 first, System.Int32 second) [0x00001] in C:\Users\Jesse\Unshared Code\Chromavaders\Library\PackageCache\com.unity.scriptablebuildpipeline@1.15.2\Editor\Utilities\ExtensionMethods.cs:27
    8.   at UnityEditor.Build.Pipeline.Tasks.GenerateSubAssetPathMaps.CreateSubAssetLoadInfo (UnityEditor.Build.Content.AssetLoadInfo assetInfo, UnityEditor.Build.Content.ObjectIdentifier subAsset) [0x00052] in C:\Users\Jesse\Unshared Code\Chromavaders\Library\PackageCache\com.unity.scriptablebuildpipeline@1.15.2\Editor\Tasks\GenerateSubAssetPathMaps.cs:63
    9.   at UnityEditor.Build.Pipeline.Tasks.GenerateSubAssetPathMaps.Run () [0x00132] in C:\Users\Jesse\Unshared Code\Chromavaders\Library\PackageCache\com.unity.scriptablebuildpipeline@1.15.2\Editor\Tasks\GenerateSubAssetPathMaps.cs:45
    10.   at UnityEditor.Build.Pipeline.BuildTasksRunner.Run (System.Collections.Generic.IList`1[T] pipeline, UnityEditor.Build.Pipeline.Interfaces.IBuildContext context) [0x000ca] in C:\Users\Jesse\Unshared Code\Chromavaders\Library\PackageCache\com.unity.scriptablebuildpipeline@1.15.2\Editor\Shared\BuildTasksRunner.cs:56
    11. UnityEditor.GenericMenu:CatchMenu (object,string[],int)
    This occurs on Windows 10, Unity 2020.2.2f1. Also, I had to disable my use of the performance testing extension, as for some reason the symbols that it requires to exist aren't defined when compiling asset bundles.

    EDIT: Fixed as of Addressables 1.17.13 and Scriptable Build Pipeline 1.17.0.
     
    Last edited: Mar 20, 2021
  2. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    This happens even after upgrading to Addressables 1.17.4-preview and Scriptable Build Pipeline 1.16.1.
     
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,820
    I'll flag this for the team to have a look!
     
    JesseSTG likes this.
  4. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    Thank you, I appreciate it. What else can I do to help?
     
  5. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,820
    JesseSTG likes this.
  6. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Hey @JesseSTG thanks for bringing this to our attention. I'll create a ticket on our end to have the SBP team look at it but I'd also go ahead and file a bug on your end. If you're able to provide your project I think that'd be very useful for them.

    Unfortunately I don't have any greater knowledge to share. I'm also not sure when the SBP team will look at this, though they are usually pretty fast.
     
  7. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    Understood, I'll do that momentarily, thank you.
     
  8. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    This issue was not fixed with Addressables 1.17.5-preview.
     
  9. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Hey @JesseSTG. So, that issue is actually part of Scriptable Build Pipeline. I believe a ticket was created but we'll have to wait for a new SBP release to come out before that gets resolved. Once it does we'll update Addressables to use the fixed version of SBP.
     
    JesseSTG likes this.
  10. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    Dang. Well, at least I have other things I can do while waiting on this. Thanks anyway!
     
  11. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Just wanted to post that in Addressables 1.17.8 (coming out in a day or two) we'll be pointing to a new version of SBP that should have a fix for your issue.
     
    JesseSTG likes this.
  12. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    Thank you! Fingers crossed.
     
  13. jeremedia

    jeremedia

    Joined:
    Apr 21, 2015
    Posts:
    63
    Now seeing this same problem. Any update on fix availability?
     
  14. suiboli314

    suiboli314

    Joined:
    Apr 8, 2020
    Posts:
    9
    Encounter the same problem after analyzing and applying fixable rules to the duplicates assets.
     
  15. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    Oh thank Christ, I'm not crazy.
     
  16. jeremedia

    jeremedia

    Joined:
    Apr 21, 2015
    Posts:
    63
    Anyone have a workaround while we wait for 1.17.8?

    @davidla_unity do you have an updated ETA? Is it worth trying to patch the error with a local copy of SBP?
     
    Last edited: Mar 19, 2021
  17. jeremedia

    jeremedia

    Joined:
    Apr 21, 2015
    Posts:
    63
    If anyone else is having this problem and needs an immediate temporary fix:

    1. Duplicate a copy of Library/PackageCache/unity.scriptablebuildpipeline@x.x.x package into \Packages
    2. Remove any version number from the package name
    3. Make the folder and contents writable
    4. Edit the Swap method on line #25 of ExtensionMethods.cs with either a try/catch or adding logic that prevents the out of range error
    That's it. Unsure if this is treating a symptom of a deeper problem, but my project builds bundles again.
     
  18. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    Fix is out! Let's take it for a spin.

    EDIT: So far so good! Addressables Analyze works on all built-in analyzers (plus one custom one) without a hitch. Gonna resolve the issues it found then I'll try to produce a build.

    EDIT II: I produced a build! I am now ready to close this chapter. Thank you!
     
    Last edited: Mar 20, 2021
    davidla_unity, TreyK-47 and jeremedia like this.
  19. simlelin

    simlelin

    Joined:
    Jan 3, 2018
    Posts:
    1
    I have fixed it by upgrading sbp to version 1.17.0.
     
  20. xjjon

    xjjon

    Joined:
    Apr 15, 2016
    Posts:
    612
    Saw this bug on iOS builds on versions up to verified 1.16.19
    Cannot build asset groups in editor either

    Seems to only happen when I included tile palette prefabs into the the addressable group.
    Removed them and it builds fine. Very strange behavior
     
  21. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
    Started happening in 2020.3.11 with all verified packages.

    Tried to analyze the bundle layout preview but it throws this error

    Code (CSharp):
    1. Build Task GenerateSubAssetPathMaps failed with exception:
    2. Index was out of range. Must be non-negative and less than the size of the collection.
    3. Parameter name: index
    4.   at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00029] in <695d1cc93cca45069c528c15c9fdd749>:0
    5.   at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
    6.   at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <695d1cc93cca45069c528c15c9fdd749>:0
    7.   at UnityEditor.Build.Pipeline.Utilities.ExtensionMethods.Swap[T] (System.Collections.Generic.IList`1[T] list, System.Int32 first, System.Int32 second) [0x00000] in H:\Game Dev\Setting Sun\Setting Sun Project\Library\PackageCache\com.unity.scriptablebuildpipeline@1.15.2\Editor\Utilities\ExtensionMethods.cs:27
    8.   at UnityEditor.Build.Pipeline.Tasks.GenerateSubAssetPathMaps.CreateSubAssetLoadInfo (UnityEditor.Build.Content.AssetLoadInfo assetInfo, UnityEditor.Build.Content.ObjectIdentifier subAsset) [0x0004c] in H:\Game Dev\Setting Sun\Setting Sun Project\Library\PackageCache\com.unity.scriptablebuildpipeline@1.15.2\Editor\Tasks\GenerateSubAssetPathMaps.cs:63
    9.   at UnityEditor.Build.Pipeline.Tasks.GenerateSubAssetPathMaps.Run () [0x0011e] in H:\Game Dev\Setting Sun\Setting Sun Project\Library\PackageCache\com.unity.scriptablebuildpipeline@1.15.2\Editor\Tasks\GenerateSubAssetPathMaps.cs:45
    10.   at UnityEditor.Build.Pipeline.BuildTasksRunner.Run (System.Collections.Generic.IList`1[T] pipeline, UnityEditor.Build.Pipeline.Interfaces.IBuildContext context) [0x00099] in H:\Game Dev\Setting Sun\Setting Sun Project\Library\PackageCache\com.unity.scriptablebuildpipeline@1.15.2\Editor\Shared\BuildTasksRunner.cs:56
    11. UnityEditor.EditorApplication:Internal_CallDelayFunctions ()
     
    Last edited: Jun 10, 2021
  22. xjjon

    xjjon

    Joined:
    Apr 15, 2016
    Posts:
    612
    Try to use 1.13.1
    Seems to be the last stable version without cross platform issue.

    This version worked for me after we upgraded from 2019 LTS -> 2020.

    For us, all the newer versions have bugs either on Android or iOS.
     
  23. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
    Updated to the latest addressables version seems to work but not sure what else might brake now ofc :p