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

Bug 2022.2.13f1 com.unity.scriptablebuildpipeline@1.21.3 sceneInfo.includedTypes may contain null

Discussion in 'Editor & General Support' started by Rational_Gremlin, Apr 3, 2023.

  1. Rational_Gremlin

    Rational_Gremlin

    Joined:
    Jun 23, 2015
    Posts:
    2
    Hello.
    I have a small problem when building addressable assets:
    After some digging, I found the main culprit:
    Code (CSharp):
    1. // ./Library/PackageCache/com.unity.scriptablebuildpipeline@1.21.3/Editor/Tasks/CalculateSceneDependencyData.cs:62
    2. #if ENABLE_TYPE_HASHING || UNITY_2020_1_OR_NEWER
    3.             var uniqueTypes = new HashSet<System.Type>(sceneInfo.includedTypes);
    4. #else
    Because sceneInfo.includedTypes may contain null, it results in addressable content build failure in
    Code (CSharp):
    1. //./Library/PackageCache/com.unity.scriptablebuildpipeline@1.21.3/Editor/Utilities/BuildCacheUtility.cs:94
    2. entry = new CacheEntry { ScriptType = type.AssemblyQualifiedName, Version = version };
    As a hotfix, I added uniqueTypes.Remove(null);
    Code (CSharp):
    1. // ./Library/PackageCache/com.unity.scriptablebuildpipeline@1.21.3/Editor/Tasks/CalculateSceneDependencyData.cs:62
    2. #if ENABLE_TYPE_HASHING || UNITY_2020_1_OR_NEWER
    3.            var uniqueTypes = new HashSet<System.Type>(sceneInfo.includedTypes);
    4.            uniqueTypes.Remove(null);
    5. #else
    Unity Version: 2022.2.13f1
    Package: com.unity.scriptablebuildpipeline@1.21.3
     
  2. yuvaledelman

    yuvaledelman

    Joined:
    Mar 8, 2023
    Posts:
    1
    Hey @Rational_Gremlin
    We are encountering the exact same issue.
    Have you found a long-term solution to it?
     
  3. Rational_Gremlin

    Rational_Gremlin

    Joined:
    Jun 23, 2015
    Posts:
    2
    Hi! @yuvaledelman
    Sadly, no. Our project is currently on hiatus, so there was no need to search for another solution.
     
  4. einWikinger

    einWikinger

    Joined:
    Jul 30, 2013
    Posts:
    96
    Running into the same issue as well after upgrading a project from 2020 to 2022. Suddenly addressable builds fail due to null types in the included scenes. For us the issue are missing scripts on game objects in scenes. This can be solved by just going through scenes and look for missing components and fix them up or delete them.

    For the SBP/addressables team I'd suggest improving reporting of errors here, and adding more context. In this case, we just get a NullReferenceException that just gets bubbled up to the main addressable build interface and it doesn't give information about what asset/scene it was currently processing while the error occured.

    For us, the issue is broadly caused by HDRP where (again?) some script called SceneIdMap vanished, which seems to be added to scenes at random. Sometimes the GOs they're attached to are even hidden, so you could get this issue even on a seemingly empty scene.

    I've posted this in the Addressables forum to get the attention of the team responsible for this part of the engine: https://forum.unity.com/threads/202...cripts-in-scene-cause-build-failures.1505066/
     
    Last edited: Oct 12, 2023