On Play "Dont destroy on Load" with a Debug Updater object is created automatically ?

I am on URP 7.3.1 + Unity 2019.4 LTS

Even on an empty scene a Dont Destroy On Load object is created.
I can’t find any relevant info if this is expected behaviour ? And if not how to fix it ?

Thank you for your time.

1 Like

anyone ?

This is basically the entry point to an in-game debug menu but as far as I know it is only implemented in HDRP. The game object is always created although it only does actual work in a debug build. Unfortunately you can’t easily get rid of it as the script is in the core SRP package and there are no options to disable it, I think, other than modifying the core package. If you’re comfortable with doing that then you can find the script at Runtime/Debugging/DebugUpdater.cs inside the core package. Then just comment everything in the script should be enough to remove it without any problems.

Thank you but I am still confused since I am on URP?

If I left it as is, would it affect my alpha release ? as you say it is only for debug mode.

1 Like

This script is part of the core SRP package so you will see this happen in URP, HDRP, and any custom SRP. Currently it looks like the game object is always created, regardless of whether it is a debug build or a shipping build. The difference seems to be that only in a debug build is the game object fully initialized and work actually gets done. That work being polling device input to detect if it needs to draw the in-game debug menu, where that menu is only implemented in HDRP. In the end, it is wasted performance and they should give us an option to opt out of it but I have never seen it show up on my profiling in either URP or HDRP projects.

2 Likes

Thank you.

Where is Runtime? There is something before that isn’t there?

I found it its in Core RP Library. I just commented out the whole script and DontDestroyOnLoad is still showing up in all my scenes.

Its part of scene load, do not comment nothing out, I think it needs to be there, I have it and it causes no harm.

It causes major game breaking harm. It’s causing my title screen to remain in new scenes.

But that DontDestroyOnLoad should not be associated with your game assets but internal Unity code

Well I don’t know about that, all I know is its creating a DonDestroyOnLoad in my hierarchy in my scenes. If I start the game at my Title Scene all the UI elements remain into the next scene.

Well, I also want to know why we can’t disable damn thing? I newer use it, and I don’t want this in my scene, besides debug input conflict with some input plugin I use, and wrote: ArgumentException: Input Button Enable Debug Button 1 is not setup", like I need this debug button. Unity start acting like windows: “We did something - deal with it”. And my favorite, how unity explain every stupidity they make: “This is by design”

This will prevent the DebugUpdater from being created, or destroy it if it already exists:
UnityEngine.Rendering.DebugManager.instance.enableRuntimeUI = false;

5 Likes

Thanks, Kenoli!!! Your solution worked for me :slight_smile:

where is UnityEngine and Rendering