Errors with the URP Debug Manager

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

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Rendering.DebugManager.UpdateActions () (at Library/PackageCache/com.unity.render-pipelines.core@7.4.3/Runtime/Debugging/DebugManager.Actions.cs:176)
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

1 Like

yep, even in 8.2
did you just duplicate URP asset?

No, it seems to happen after I build to Xcode and return to Unity… Seems a little strange.

1 Like

File a bug report or it’ll stain

1 Like

also seeing this quite frequently…

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.

1 Like

+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…

Can also confirm that this error started occurring after disabling Domain Reload and doesn’t occur with Domain Reload enabled.

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:

When looking through the code, the debug actions are set in the constructor

DebugManager()
{
    if (!Debug.isDebugBuild)
        return;

    RegisterInputs();
    RegisterActions();
}

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).

public class IsDebugBuildLogger : IPostprocessBuildWithReport
{
    public int callbackOrder => -10000;

    public void OnPostprocessBuild(BuildReport report)
    {
        var isDebugBuild = Debug.isDebugBuild;
        if (!isDebugBuild)
        {
            // This will be triggered when building a non-debug build.
           Debug.LogError("isDebugBuild is false, even though we're in the editor!"); 
        }

        Debug.Log($"Is debug build: {isDebugBuild}");
    }
}

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:

DebugManager()
{
    #if !UNITY_EDITOR
    if (!Debug.isDebugBuild)
        return;
    #endif

    RegisterInputs();
    RegisterActions();
}

Okay, I’ll post this as a bug report now :smile:

7 Likes

Good news, issue has been replicated and approved: Unity Issue Tracker - isDebugBuild returns False in the Editor when its value is checked after a build

From my understanding, this issue should fix this annoying bug with the debugmanager :slight_smile:

6 Likes

Hello,

How is it possible I am still having this issue if it’s fixed already? I am on Unity 2021.1.16f.

Edit: It’s not fixed yet???

Thanks,
jrDev

1 Like

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.

This is possible, since the instance will be lost and the constructor will be called again (with registering everything it should).
@crafTDev 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.

1 Like

Just hit this, URP 12.1.4. Fix not expected I guess by now…

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.

4 Likes

They can’t fix crashes in new versions … And you write about a year here

https://discussions.unity.com/t/869978

I don’t understand, what does that issue have to do this the issue this thread is discussing?

1 Like

Because the error occurs because of this package…

This entire forum is dedicated to that package. Let’s keep this one focused on this specific issue.

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…

https://www.youtube.com/watch?v=_HOzCcbF5G4