Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions com.unity.render-pipelines.core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed Lens Flare Thumbnails
- Fixed Lens Flare 'radialScreenAttenuationCurve invisible'
- Fixed Lens Flare rotation for Curve Distribution
- Fixed potentially conflicting runtime Rendering Debugger UI command by adding an option to disable runtime UI altogether (1345783).

### Changed
- Improved the warning messages for Volumes and their Colliders.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ This page contains an overview of new features, improvements, and issues resolve
The RTHandle System no longer requires you to specify the number of MSAA samples at initialization time. This means that you can now set the number of samples on a per texture basis, rather than for the whole system.

In practice, this means that the initialization APIs no longer require MSAA related parameters. The `Alloc` functions have replaced the `enableMSAA` parameter and enables you to explicitly set the number of samples.

### New API to disable runtime Rendering Debugger UI

It is now possible to disable the Rendering Debugger UI at runtime by using [DebugManager.enableRuntimeUI](https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@latest/api/UnityEngine.Rendering.DebugManager.html#UnityEngine_Rendering_DebugManager_enableRuntimeUI).
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ void RegisterActions()
moveHorizontal.repeatMode = DebugActionRepeatMode.Delay;
moveHorizontal.repeatDelay = 0.16f;
AddAction(DebugAction.MoveHorizontal, moveHorizontal);
}

internal void EnableInputActions()
{
#if USE_INPUT_SYSTEM
foreach (var action in debugActionMap)
action.Enable();
Expand Down
39 changes: 31 additions & 8 deletions com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,30 @@ public ReadOnlyCollection<DebugUI.Panel> panels
/// </summary>
public bool displayEditorUI => m_EditorOpen;
/// <summary>
/// Controls whether the hotkey for opening and closing the debug window is enabled.
/// </summary>
public bool enableWindowHotkey = true;
/// <summary>
/// Toggle the debug window.
/// </summary>
/// <param name="open">State of the debug window.</param>
public void ToggleEditorUI(bool open) => m_EditorOpen = open;

private bool m_EnableRuntimeUI = true;

/// <summary>
/// Controls whether runtime UI can be enabled. When this is set to false, there will be no overhead
/// from debug GameObjects or runtime initialization.
/// </summary>
public bool enableRuntimeUI
{
get => m_EnableRuntimeUI;
set
{
if (value != m_EnableRuntimeUI)
{
m_EnableRuntimeUI = value;
DebugUpdater.SetEnabled(value);
}
}
}

/// <summary>
/// Displays the runtime version of the debug window.
/// </summary>
Expand Down Expand Up @@ -136,8 +151,16 @@ public bool displayPersistentRuntimeUI
get => m_RootUIPersistentCanvas != null && m_PersistentRoot.activeInHierarchy;
set
{
CheckPersistentCanvas();
m_PersistentRoot.SetActive(value);
if (value)
{
EnsurePersistentCanvas();
}
else
{
CoreUtils.Destroy(m_PersistentRoot);
m_PersistentRoot = null;
m_RootUIPersistentCanvas = null;
}
}
}

Expand Down Expand Up @@ -220,7 +243,7 @@ internal void SetScrollTarget(DebugUIHandlerWidget widget)
m_RootUICanvas.SetScrollTarget(widget);
}

void CheckPersistentCanvas()
void EnsurePersistentCanvas()
{
if (m_RootUIPersistentCanvas == null)
{
Expand Down Expand Up @@ -253,7 +276,7 @@ internal void TogglePersistent(DebugUI.Widget widget)
return;
}

CheckPersistentCanvas();
EnsurePersistentCanvas();
m_RootUIPersistentCanvas.Toggle(valueWidget);
}

Expand Down
35 changes: 31 additions & 4 deletions com.unity.render-pipelines.core/Runtime/Debugging/DebugUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,26 @@ class DebugUpdater : MonoBehaviour
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
static void RuntimeInit()
{
if (!Debug.isDebugBuild || FindObjectOfType<DebugUpdater>() != null)
if (!Debug.isDebugBuild || !DebugManager.instance.enableRuntimeUI || FindObjectOfType<DebugUpdater>() != null)
return;

EnableRuntime();
}

internal static void SetEnabled(bool enabled)
{
if (enabled)
EnableRuntime();
else
DisableRuntime();
}

static void EnableRuntime()
{
var go = new GameObject { name = "[Debug Updater]" };
var debugUpdater = go.AddComponent<DebugUpdater>();

var es = GameObject.FindObjectOfType<EventSystem>();
var es = FindObjectOfType<EventSystem>();
if (es == null)
{
go.AddComponent<EventSystem>();
Expand Down Expand Up @@ -69,6 +82,21 @@ static void RuntimeInit()
debugUpdater.m_Orientation = Screen.orientation;

DontDestroyOnLoad(go);

DebugManager.instance.EnableInputActions();
}

static void DisableRuntime()
{
DebugManager debugManager = DebugManager.instance;
debugManager.displayRuntimeUI = false;
debugManager.displayPersistentRuntimeUI = false;

var debugUpdater = FindObjectOfType<DebugUpdater>();
if (debugUpdater != null)
{
CoreUtils.Destroy(debugUpdater.gameObject);
}
}

void Update()
Expand All @@ -80,8 +108,7 @@ void Update()
if (debugManager.GetAction(DebugAction.EnableDebugMenu) != 0.0f ||
debugManager.GetActionToggleDebugMenuWithTouch())
{
if (debugManager.enableWindowHotkey)
debugManager.displayRuntimeUI = !debugManager.displayRuntimeUI;
debugManager.displayRuntimeUI = !debugManager.displayRuntimeUI;
}

if (debugManager.displayRuntimeUI)
Expand Down
1 change: 0 additions & 1 deletion com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Prevent any unwanted light sync when not in HDRP (case 1217575)
- Fixed missing global wind parameters in the visual environment.
- Fixed fabric IBL (Charlie) pre-convolution performance and accuracy (uses 1000x less samples and is closer match with the ground truth)
- Fixed conflicting runtime debug menu command with an option to disable runtime debug window hotkey.
- Fixed screen-space shadows with XR single-pass and camera relative rendering (1348260).
- Fixed ghosting issues if the exposure changed too much (RTGI).
- Fixed failures on platforms that do not support ray tracing due to an engine behavior change.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,29 @@ The **Rendering Debugger** is a specific window for the Scriptable Render Pipeli
- [Rendering](#RenderingPanel)
- [Camera](#CameraPanel)

![](Images/RenderPipelineDebug1.png)

The Rendering Debugger.
![](Images/RenderPipelineDebug1.png)<br/>*The Rendering Debugger.*

## Using the Rendering Debugger

To open the Rendering Debugger in the Editor, you must first enable **Runtime Debug Shaders** in **HDRP Global Settings**:
The Rendering Debugger window is available in the following modes:

* The Editor.

* The Play mode.

* At runtime in the standalone Unity Player, on any device. The window is only available in **Development Builds**.

To open the Rendering Debugger in the Editor:

* Enable **Runtime Debug Shaders** in **HDRP Global Settings** (in the menu: **Edit > Project Settings > Graphics > HDRP Settings**).

1. Go to **Edit > Project Settings > Graphics**
2. Click **HDRP Settings**
3. Enable **Runtime Debug Shaders**
* Select **Window > Analysis > Rendering Debugger**.

To open the Rendering Debugger, go to **Window > Analysis > Rendering Debugger**.
To open the window in the Play mode, or at runtime in a Development Build, use the keyboard shortcut Ctrl+Backspace (Ctrl+Delete on macOS) or press L3 and R3 (Left Stick and Right Stick) on a controller.

You can also open this window at runtime in Play Mode, or in the standalone Unity Player on any device on **Development build**. Use the keyboard shortcut Ctrl+Backspace (Ctrl+Delete on macOS) or press L3 and R3 (Left Stick and Right Stick) on a controller to open the window. You can disable the shortcut through the [enableWindowHotkey variable](https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.Rendering.DebugManager.html#UnityEngine_Rendering_DebugManager_enableWindowHotkey).
You can display read-only items, such as the FPS counter, independently of the **Rendering Debugger** window. When you disable the **Rendering Debugger** window, they are still visible in the top right corner of the screen. Use this functionality to track particular values without cluttering the screen.

You can display read-only items such as the FPS counter independently of the **Rendering Debugger**. This means that when you disable the **Rendering Debugger**, 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.
You can disable the runtime UI entirely by using the [enableRuntimeUI](https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@latest/api/UnityEngine.Rendering.DebugManager.html#UnityEngine_Rendering_DebugManager_enableRuntimeUI) property.

### Navigation at runtime

Expand Down