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)
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, 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…
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:
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.
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.