Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Errors with the URP Debug Manager

Discussion in 'Universal Render Pipeline' started by petey, Oct 13, 2020.

  1. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,810
    Has anyone seen these errors?
    They go away if I restart Unity but it's getting tedious. I'm on URP 7.1.3 Unity 2019.4

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.Rendering.DebugManager.UpdateActions () (at Library/PackageCache/com.unity.render-pipelines.core@7.4.3/Runtime/Debugging/DebugManager.Actions.cs:176)
    3. UnityEngine.Rendering.DebugUpdater.Update () (at Library/PackageCache/com.unity.render-pipelines.core@7.4.3/Runtime/Debugging/DebugUpdater.cs:18)
    Is there a way I can fix that?

    Thanks,
    Pete
     
    wlwl2 likes this.
  2. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,155
    yep, even in 8.2
    did you just duplicate URP asset?
     
  3. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,810
    No, it seems to happen after I build to Xcode and return to Unity... Seems a little strange.
     
    AldeRoberge likes this.
  4. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,155
    File a bug report or it'll stain
     
    wlwl2 likes this.
  5. dthurn

    dthurn

    Joined:
    Feb 17, 2015
    Posts:
    77
    also seeing this quite frequently...
     
  6. johanolofsson

    johanolofsson

    Joined:
    Nov 21, 2018
    Posts:
    94
    I got it too, super annoying. For me it only appears after disabling domain reload. With that enabled I don't get it. I.e. there is likely some static stuff in the URP code that is not being properly reset.
     
    LTPStudioXR likes this.
  7. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    +1, also happens to me several times a day with Domain Reload disabled. With Domain Reload enabled, it never happens. I have no idea what causes it to occur, as the previous commenter said it's surely related to URP code not handling the no-domain-reload workflow.

    Has anyone been able to create a minimal repro project and submit a bug? My project is too big to submit a bug...
     
  8. ScallyGames

    ScallyGames

    Joined:
    Sep 10, 2012
    Posts:
    38
    Can also confirm that this error started occurring after disabling Domain Reload and doesn't occur with Domain Reload enabled.
     
  9. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    820
    Having the same problem (2020.2.5f1, but also before) after builindg for iOS or android with Enter Play Mode Options enabled. Sadly it does not always happen for me... Quite annoying but hard to send a bug report.
    I tried debugging it and might have an idea. The Debug Manager instance looks like this:
    upload_2021-2-26_19-15-34.png

    When looking through the code, the debug actions are set in the constructor
    Code (CSharp):
    1. DebugManager()
    2. {
    3.     if (!Debug.isDebugBuild)
    4.         return;
    5.  
    6.     RegisterInputs();
    7.     RegisterActions();
    8. }
    When entering playmode with domain reload RegisterInputs gets called. It should be called from the constructor, but debugging the decompiled library is a bit strange sometimes with Rider. I couldn't find any other point from which RegisterInputs gets called, so it should be the constructor. From the documentation "In the editor isDebugBuild always returns true."

    Well, as it turns out this statement is not always true. E.g. when building a non debug build (which is a good thing to be able to test that I guess).
    Code (CSharp):
    1. public class IsDebugBuildLogger : IPostprocessBuildWithReport
    2. {
    3.     public int callbackOrder => -10000;
    4.  
    5.     public void OnPostprocessBuild(BuildReport report)
    6.     {
    7.         var isDebugBuild = Debug.isDebugBuild;
    8.         if (!isDebugBuild)
    9.         {
    10.             // This will be triggered when building a non-debug build.
    11.            Debug.LogError("isDebugBuild is false, even though we're in the editor!");
    12.         }
    13.  
    14.         Debug.Log($"Is debug build: {isDebugBuild}");
    15.     }
    16. }
    So my guess is, the DebugManager constructor might sometimes get called while or after building the project and then skips RegisterInputs and RegisterActions. A quick fix would be:

    Code (CSharp):
    1. DebugManager()
    2. {
    3.     #if !UNITY_EDITOR
    4.     if (!Debug.isDebugBuild)
    5.         return;
    6.     #endif
    7.  
    8.     RegisterInputs();
    9.     RegisterActions();
    10. }
    Okay, I'll post this as a bug report now :D
     
    Last edited: Feb 26, 2021
  10. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    820
  11. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    AldeRoberge likes this.
  12. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,810
    The status on that bug is still ‘Active’, so they’ll probably fix it, just might take a while.
    It’s great that Johannski was able to repro it :).
    I found if I click on the error in Unity console and even just put a space or something in the script file, it seems to work fine again.
    Not sure what’s going on there, but it’s better than restarting.
     
  13. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    820
    This is possible, since the instance will be lost and the constructor will be called again (with registering everything it should).
    @jrDev Yes, sadly still not fixed. I'm a bit disappointed, since I made a very detailed analysis. A hotfix would be very easy, but I guess they might want to tackle the underlying problem, which is a lot more work.
     
    CarXdev likes this.
  14. KimmoFactor

    KimmoFactor

    Joined:
    Dec 29, 2020
    Posts:
    39
    Just hit this, URP 12.1.4. Fix not expected I guess by now...
     
  15. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Mind-blowing to me that this hasn't been fixed in over a year. This is an incredibly common workflow: domain reload disabled, using URP. Both headline features from Unity in the past few years. I still get this issue on a regular basis, on the latest versions of both the 2020 LTS release and 2021.2.
     
  16. ep1s0de

    ep1s0de

    Joined:
    Dec 24, 2015
    Posts:
    168
    They can’t fix crashes in new versions ... And you write about a year here

    https://forum.unity.com/threads/native-crash-reporting-when-importing-urp-or-hdrp.1232112/
     
  17. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Johannski likes this.
  18. ep1s0de

    ep1s0de

    Joined:
    Dec 24, 2015
    Posts:
    168
    Because the error occurs because of this package...
     
  19. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    This entire forum is dedicated to that package. Let’s keep this one focused on this specific issue.
     
  20. ep1s0de

    ep1s0de

    Joined:
    Dec 24, 2015
    Posts:
    168
    Creating a new URP project
    No manipulations with files and stuff...
    Version: 2022.1.0b5 (It's the same with version 2021.2)
    I cut out long moments...
     
  21. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    Please stop posting about that issue in this thread. It isn’t related to the bug this thread was started to discuss. I’m sorry you’re having that issue, but I think we’ll only make things more confusing by mixing it up with this thread.
     
    Nith666, Johannski and petey like this.
  22. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Getting this in HDRP too, on 2021.2.11.
     
  23. SniperED007

    SniperED007

    Joined:
    Sep 29, 2013
    Posts:
    345
    This is so annoying.
    Still happens in 2021.2.14f1
     
  24. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,922
    Same happend on my side too
     
  25. matt_cauldron

    matt_cauldron

    Joined:
    Dec 17, 2021
    Posts:
    48
    +1 on this, although I don't run into it on MacOS, only windows
     
  26. aromana

    aromana

    Joined:
    Nov 11, 2018
    Posts:
    137
    This bug happens on all OSes, so I'm not sure why that would be the case for you. Happens to me on macOS at least once a day. The root cause was explained above and isn't affected by OS.
     
  27. SoshJam

    SoshJam

    Joined:
    Dec 23, 2016
    Posts:
    8
    Happening for me too on 2021.2.17f1
     
    ROBYER1 likes this.
  28. matt_cauldron

    matt_cauldron

    Joined:
    Dec 17, 2021
    Posts:
    48
    Yeah can confirm, I've just seen it on Mac, though a lot rarer.

    Just now it occurred after syncing to a new git commit for the project, with Unity open in the background - switching back and hitting these errors in play mode.

    That the bug has been active since March 2021 is not very encouraging, suspect it's very low down on Unity's prioritisation backlog.
     
  29. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    Just encountered it, googled it, ended up here :)
    Windows, Unity 2020.3.27f1

    Code (CSharp):
    1. [Exception] NullReferenceException: Object reference not set to an instance of an object
    2. DebugManager.UpdateActions() at Library/PackageCache/com.unity.render-pipelines.core@10.8.1/Runtime/Debugging/DebugManager.Actions.cs:241
    3. 239:   internal void UpdateActions()
    4. 240:   {
    5. -->241:       for (int actionIndex = 0; actionIndex < m_DebugActions.Length; ++actionIndex)
    6. 242:       {
    7. 243:           UpdateAction(actionIndex);
    8.  
    9. DebugUpdater.Update() at Library/PackageCache/com.unity.render-pipelines.core@10.8.1/Runtime/Debugging/DebugUpdater.cs:18
    10. 16:   void Update()
    11. 17:   {
    12. -->18:       DebugManager.instance.UpdateActions();
    13. 20:       if (DebugManager.instance.GetAction(DebugAction.EnableDebugMenu) != 0.0f)
    14.  
     
  30. SunnysideGames

    SunnysideGames

    Joined:
    May 14, 2014
    Posts:
    23
    Come on Unity URP Team, what is wrong with you guys ?
    It's an easy fix as said before and it's been here for two years now. Some days it happens at each domain reload. Why aren't you doing something about it ?

    What the hell.
     
    Jimaniki likes this.
  31. Tornar

    Tornar

    Joined:
    Dec 28, 2020
    Posts:
    87
    I am having this issue too in Linux using Unity 2021.2.19f1
     
  32. giraffe1

    giraffe1

    Joined:
    Nov 1, 2014
    Posts:
    298
    Same unity version as you and I got it too just now. os is windows.
     
    Last edited: Apr 14, 2022
    palourde likes this.
  33. giraffe1

    giraffe1

    Joined:
    Nov 1, 2014
    Posts:
    298
    Notes:
    - Restarting the Editor resets isDebugBuild to True

    Does anyone know how to restart the editor? Does restarting mean closing my project and re-opening it? That did not fix the problem for me.

    Anyone know? My build is getting bombarded by the null ref error making the dev. console in build unusable for anything.
     
    PowerJake and andreiagmu like this.
  34. SunnysideGames

    SunnysideGames

    Joined:
    May 14, 2014
    Posts:
    23
    I guess a temporary hack would be to have a script in the scene access at runtime through reflection the s_Instance static variable of the DebugUpdater class, and disable it ? That would remove the null errors
     
    giraffe1 likes this.
  35. andreiagmu

    andreiagmu

    Joined:
    Feb 20, 2014
    Posts:
    175
    I usually work with Domain Reload disabled, and then I bumped into this error today.
    Just now, I tried disabling "Enter Play Mode Options" before making a build, then the development build worked correctly!

    Before making a build, disabling "Enter Play Mode Options" may help avoid the URP Debug Manager errors.
    It's not ideal, but it works as a quick workaround.
     
  36. dogboydog

    dogboydog

    Joined:
    Nov 23, 2012
    Posts:
    53
    this error comes out thousands of times even playing a build for one minute. It's sad when these disruptive issues stay open for so long with no acknowledgment especially when someone went through so much trouble to do detailed research of the cause. I voted and commented on the issue. Mentioned workarounds don't help for me.
     
    Last edited: Apr 15, 2022
  37. andreiagmu

    andreiagmu

    Joined:
    Feb 20, 2014
    Posts:
    175
    Thank you very much for the tip! :D
    I tried a simpler variation of this idea:

    I wrote this simple script to disable URP DebugManager's runtime UI (no idea what this is) and attached it to a GameObject in the very first scene of my game. After the scene loads, the URP runtime debugger (?) is immediately disabled.

    This doesn't affect the standard runtime console, it'll still show errors/exceptions as usual (only if you have them in your code, of course), but now it won't spam those URP Debug Manager exceptions anymore. :)

    IMPORTANT: If you use assembly definitions (.asmdef files), you need to add an assembly reference to
    Unity.RenderPipelines.Core.Runtime
    on the assembly where this script will be located.
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Rendering;
    3.  
    4. public class DisableURPDebugUpdater : MonoBehaviour
    5. {
    6.     private void Awake()
    7.     {
    8.         DebugManager.instance.enableRuntimeUI = false;
    9.     }
    10. }
    In my recent tests, after I make a Development Build, the URP Debug Manager errors don't appear in the build anymore (thanks to the above script), but may start appearing in the Unity Editor instead (possibly because I disabled Domain Reload).

    In this case, disabling Enter Play Mode Options, then entering Play Mode (doing a full domain reload) makes the errors stop appearing in the Editor.
    After that, I can enable Enter Play Mode Options again and the errors won't appear, at least until I make the next development build.
     
    Last edited: Apr 17, 2022
  38. dogboydog

    dogboydog

    Joined:
    Nov 23, 2012
    Posts:
    53
    Awesome! This worked for me too. I attached the script to my custom splash screen scene and I'm not getting the error spam anymore. Great workaround until Unity fixes the real issue.
     
    andreiagmu likes this.
  39. Strom_CL

    Strom_CL

    Joined:
    Nov 17, 2012
    Posts:
    109
    Still happening in 2021.3.0f1 LTS :(
     
    andreiagmu likes this.
  40. SunnysideGames

    SunnysideGames

    Joined:
    May 14, 2014
    Posts:
    23
    Oh yeah that's better! Thanks a lot !
     
    andreiagmu likes this.
  41. andreiagmu

    andreiagmu

    Joined:
    Feb 20, 2014
    Posts:
    175
  42. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    This happened in 2021.3.1f1 LTS (HDRP) also. However @andreiagmu script fixed for now. Thank you!
     
    andreiagmu likes this.
  43. darthdeus

    darthdeus

    Joined:
    Oct 13, 2013
    Posts:
    60
    I can confirm it happens in 2021.3.1f0 LTS with URP on Windows. Unchecking "Enter Play Mode Options" works, but it also makes entering playmode unusably slow in our project.

    The posted workaround seems to work the second time I press play. If I make a build and then run the game I get the errors, but if I stop the game and play again I won't get the errors after that.
     
    andreiagmu likes this.
  44. andreiagmu

    andreiagmu

    Joined:
    Feb 20, 2014
    Posts:
    175
    About these errors you said happened after you made the build: when you say "If I make a build and then run the game I get the errors, but if I stop the game and play again," did you mean running/stopping the build or running/stopping Play Mode in the Editor?

    My script should work the first time in the build (if you had errors there). But it doesn't avoid the errors in the Editor after the build. So you may have to stop/enter Play Mode again as you described, or even temporarily disable "Enter Play Mode Options" and then run Play Mode (only once, after the build; then you can re-enable it) to clear Unity's internal references.
     
    Last edited: May 3, 2022
  45. dogboydog

    dogboydog

    Joined:
    Nov 23, 2012
    Posts:
    53
    Weirdly for me I have never once seen these errors in the Editor. Only in builds
     
  46. alexniver

    alexniver

    Joined:
    Mar 8, 2014
    Posts:
    6
    2021.2.13f1c1, error in build if check "Development Build"


    NullReferenceException: Object reference not set to an instance of an object
    at UnityEngine.Rendering.DebugManager.UpdateActions () [0x0001b] in D:\Deployment\unity\PapiuAll\Library\PackageCache\com.unity.render-pipelines.core@12.1.4\Runtime\Debugging\DebugManager.Actions.cs:244
    at UnityEngine.Rendering.DebugUpdater.Update () [0x0002a] in D:\Deployment\unity\PapiuAll\Library\PackageCache\com.unity.render-pipelines.core@12.1.4\Runtime\Debugging\DebugUpdater.cs:180
     
    Lex, spvn and EAST-DATA like this.
  47. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,516
    I have the same issue with "Development Build" build player consistently throws the same error.

    NullReferenceException: Object reference not set to an instance of an object UnityEngine.Rendering.DebugManager.UpdateActions () (at C:/Project/SubterrainMT_PC/UnityProject/Library/PackageCache/com.unity.render-pipelines.core@12.1.6/Runtime/Debugging/DebugManager.Actions.cs:244)
    UnityEngine.Rendering.DebugUpdater.Update () (at C:/Project/SubterrainMT_PC/UnityProject/Library/PackageCache/com.unity.render-pipelines.core@12.1.6/Runtime/Debugging/DebugUpdater.cs:180)
     
    alexSquared likes this.
  48. Tornar

    Tornar

    Joined:
    Dec 28, 2020
    Posts:
    87
    I still have this issue in Unity 2021.3.3f1
     
    gooby429 likes this.
  49. giraffe1

    giraffe1

    Joined:
    Nov 1, 2014
    Posts:
    298
    How many years does Unity usually take to fix simple bugs?
     
    Jimaniki and Walter_Hulsebos like this.
  50. Terraya

    Terraya

    Joined:
    Mar 8, 2018
    Posts:
    646
    Hmm, need to take @andreiagmu his fix ...

    hope they fix it soon ;)
     
    andreiagmu likes this.