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 Something different with compile on 2021.3.15f1 +

Discussion in 'Editor & General Support' started by commonblob, Dec 16, 2022.

  1. commonblob

    commonblob

    Joined:
    Apr 24, 2015
    Posts:
    20
    So my URP game compiles fine on 2021.3.14f1. However, if I upgrade my project to either 2021.3.15 or 2021.3.16 it crashes during build.

    Looking at the Editor.log I get the following error before it dies:

    Compiling shader "Hidden/Universal Render Pipeline/Sampling" pass "BoxDownsample" (vp)
    Uploading Crash Report
    NullReferenceException
    at (wrapper managed-to-native)


    It then follows on with a "Managed Stacktrace"


    =================================================================
    Managed Stacktrace:
    =================================================================
    at <unknown> <0xffffffff>
    at UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck <0x001a7>
    at DefaultBuildMethods:BuildPlayer <0x013b2>
    at UnityEditor.BuildPlayerWindow:CallBuildMethods <0x0098a>
    at UnityEditor.BuildPlayerWindow:GUIBuildButtons <0x026c2>
    at UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings <0x067a2>
    at UnityEditor.BuildPlayerWindow:OnGUI <0x00f12>


    Has anyone seen this?
     
  2. GCatz

    GCatz

    Joined:
    Jul 31, 2012
    Posts:
    281
    something is wrong with LST releases every new version is buggier
     
    Last edited: Dec 16, 2022
    kevinksmith likes this.
  3. tw00275

    tw00275

    Joined:
    Oct 19, 2018
    Posts:
    24
    I'm having the same issue so I'm staying on 2021.3.14f1 unless this gets fixed. I can build a project made with the URP template on the newer versions but when I've added in all of my project assets I get the same crash when building. Crashes on both Windows 11 and macOS M1 so it's not a platform issue.

    I've had a look through the patch notes and this change could be the cause:

    2021.3.15f1:
    Fixes:
    Editor: Enabling shader keyword pre-filtering so that build process does not have to enumerate through full shader variant space. This fixes the issue of URP builds even with warm shader cache taking really long time. This fix does not reduce the time spent on actually compiling shaders. (UUM-3711) https://issuetracker.unity3d.com/issues/shader-variant-build-preparation-does-not-scale
     
  4. commonblob

    commonblob

    Joined:
    Apr 24, 2015
    Posts:
    20
    This certainly could be the issue. I cleared out my Library folder and on the new version which didnt make a difference either.
     
  5. argibaltzi

    argibaltzi

    Joined:
    Nov 13, 2014
    Posts:
    218
    How do we fix this problem? Anyone know?
    All the new versions have this problem
     
    Last edited: Jan 12, 2023
  6. commonblob

    commonblob

    Joined:
    Apr 24, 2015
    Posts:
    20
    I guess we should log a case with Unity, or hopefully they see this forum post.
     
  7. RamonLion

    RamonLion

    Joined:
    Jul 19, 2012
    Posts:
    9
    I converted back to 2021.3.14f1 and successfully made a build no other changes needed. Thankfully nothing got corrupted or damaged in the downgrade.
     
    argibaltzi likes this.
  8. commonblob

    commonblob

    Joined:
    Apr 24, 2015
    Posts:
    20
    Quick update to say this still occurs in the newly released 2021.3.17f1 build.
    It also occurs on 2022.2.

    I have raised a bug report, but im not sure what causes it so may be too difficult to reproduce
     
  9. commonblob

    commonblob

    Joined:
    Apr 24, 2015
    Posts:
    20
    Looks like this, at least in my case, was caused by Unistorm. By removing the render features for that, the crash no longer happened.

    I have reached out to the developer of Unistorm for some assistance.
     
  10. RamonLion

    RamonLion

    Joined:
    Jul 19, 2012
    Posts:
    9
    I also use Unistorm.

    I've also been having issue with builds only rendering light like 10% of the time. So I'm just building and building, hoping for the build that sticks.

    Added: After leaving my computer off over night, the build issues I mention where I'm only having a 10% success rate at having a visible build has vanished. Just something to try if anyone sees this and is at odds.
     
    Last edited: Jan 26, 2023
  11. tw00275

    tw00275

    Joined:
    Oct 19, 2018
    Posts:
    24
    Upgrading to 2021.3.17f1 fixed the issue for me. Thank you to the Unity team for addressing this. I am not using Unistorm though.
     
    RamonLion likes this.
  12. Anikki

    Anikki

    Joined:
    Dec 23, 2012
    Posts:
    8
    Managed to fix it by removing UniStorm render features aswell (on version 2021.3.19f1).
     
  13. tylearymf_unity

    tylearymf_unity

    Joined:
    May 25, 2022
    Posts:
    12
    The temporary solution is to check all your RenderFeature scripts and mark all fields of UnityEngine.Object derived types with [NonSerialized] attribute, such as:

    Code (CSharp):
    1. [NonSerialized]
    2. public Transform shadowCaster;
    This is because the GatherFilterData method recursively traverses all the referenced types in the RenderAsset and retrieves their public fields or fields marked with the SerializeField attribute. However, there is a problem with the code logic written by Unity:

    Code (CSharp):
    1.         object value = fieldInfo.GetValue(containerObject);
    2.         if (value == null)
    3.         {
    4.             continue;
    5.         }
    6.         Type type = value.GetType();
    7.         if (value is IEnumerable)
    8.         {
    9.             IEnumerable enumerable = value as IEnumerable;
    10.             bool flag2 = settingsNode != null && settingsNode.m_Children.Count > 0;
    11.             foreach (object item in enumerable)
    If the data obtained through GetValue in the first line is of the UnityEngine.Object type, Unity casts it as an object, but it is actually a "null" value in the C# object, which is != null. If the value is a Transform type object, the code will run into the foreach loop and retrieve the childCount, causing a NullReferenceException.
     
  14. tylearymf_unity

    tylearymf_unity

    Joined:
    May 25, 2022
    Posts:
    12
    upload_2023-5-5_21-24-6.png
    Unity, Could you please fix this issue?