Skip to content

Commit 5d46e89

Browse files
Add API to completely disable Runtime Debug UI (#5339) (#5982)
* Add DebugManager.enableRuntimeUI that disables DebugUpdater entirely. The code structure has changed quite a bit so this backport only includes the essential part required to fix case 1345783.
1 parent 957ef55 commit 5d46e89

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

com.unity.render-pipelines.core/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
## [10.8.0] - 2021-09-20
88

99
Version Updated
10-
The version number for this package has increased due to a version update of a related graphics package.
10+
The version number for this package has increased due to a version update of a related graphics package.

### Fixed
- Fixed potentially conflicting runtime Rendering Debugger UI command by adding an option to disable runtime UI altogether (1345783).
1111

1212
## [10.7.0] - 2021-07-02
1313

com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,24 @@ public ReadOnlyCollection<DebugUI.Panel> panels
8888
/// <param name="open">State of the debug window.</param>
8989
public void ToggleEditorUI(bool open) => m_EditorOpen = open;
9090

91+
private bool m_EnableRuntimeUI = true;
92+
93+
/// <summary>
94+
/// Controls whether runtime UI can be enabled. When this is set to false, there will be no overhead
95+
/// from debug GameObjects or runtime initialization.
96+
/// </summary>
97+
public bool enableRuntimeUI
98+
{
99+
get => m_EnableRuntimeUI;
100+
set
101+
{
102+
if (value != m_EnableRuntimeUI)
103+
{
104+
m_EnableRuntimeUI = value;
105+
}
106+
}
107+
}
108+
91109
/// <summary>
92110
/// Displays the runtime version of the debug window.
93111
/// </summary>

com.unity.render-pipelines.core/Runtime/Debugging/DebugUpdater.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class DebugUpdater : MonoBehaviour
55
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
66
static void RuntimeInit()
77
{
8-
if (!Debug.isDebugBuild || FindObjectOfType<DebugUpdater>() != null)
8+
if (!Debug.isDebugBuild || !DebugManager.instance.enableRuntimeUI || FindObjectOfType<DebugUpdater>() != null)
99
return;
1010

1111
var go = new GameObject { name = "[Debug Updater]" };

com.unity.render-pipelines.high-definition/Documentation~/Render-Pipeline-Debug-Window.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ To open the Render Pipeline Debug window in the Editor, go to **Window > Render
2121

2222
You can display read-only items such as the FPS counter independently of the **Render Pipeline Debug** window. This means that when you disable the **Render Pipeline Debug** window, they are still visible in the top right corner of the screen. This is particularly useful if you want to track particular values without cluttering the screen.
2323

24+
You can disable the runtime UI entirely by using the [enableRuntimeUI](https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.Rendering.DebugManager.html#UnityEngine_Rendering_DebugManager_enableRuntimeUI) property.
25+
2426
### Navigation at runtime
2527

2628
To change the current active item:

0 commit comments

Comments
 (0)