Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

ScriptableBuildPipeline type cache issue

Discussion in 'Addressables' started by dzamani, Dec 10, 2020.

  1. dzamani

    dzamani

    Joined:
    Feb 25, 2014
    Posts:
    122
    Hi everyone,

    So I'll start by saying that I did not log this issue through the bug reporter but I did track it down a bit in order to help.
    With Addressables 1.16.15 and ScriptableBuildPipeline 1.15.1 I have an issue where, when I add a scene to be built into a group, building the addressables will fail during the GenerateBundleCommands task at line 189.

    It's in GetSortedSceneObjectIdentifiers that it throws an out of range exception, here is the code where the exception is thrown:

    Code (CSharp):
    1. static List<ObjectIdentifier> GetSortedSceneObjectIdentifiers(List<ObjectIdentifier> objects)
    2. {
    3.     var types = new List<Type>(BuildCacheUtility.GetTypeForObjects(objects));
    4.     var sortedObjects = new List<SortObject>();
    5.     for (int i = 0; i < objects.Count; i++)
    6.         sortedObjects.Add(new SortObject { sortIndex = GetSortIndex(types[i]), objectId = objects[i] });
    7.     return sortedObjects.OrderBy(x => x.sortIndex).Select(x => x.objectId).ToList();
    8. }
    What I have in my project (100% repro in my project but currently don't have time to make a repro case) is that the array "types" will have a size of around 150 while the array "objects" will be around 12000 thus throwing the exception in the for loop.

    Went back to addressables 1.16.10 with the previous version of ScriptableBuildPipeline which is working fine, just wanted to at least make a thread about this issue that some may have soon if they update to the latest version.

    Thanks!

    Unity version: 2018.4.25f1.
     
    Last edited: Dec 10, 2020
    mike6502 likes this.
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,816
    Thanks for flagging! I'll forward this to the team for them to review!
     
  3. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,816
    It was advised that you submit a but report for us, if you haven't already.
     
  4. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    762
    From our build team:
    There's a PR up for it and it should be resolved in the next release (or possibly the one right after but I doubt it) of SBP
     
    dzamani likes this.