Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -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 @@ -309,7 +309,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 @@ -16,10 +16,12 @@ The Render Pipeline Debugger window.

## Using the Render Pipeline Debugger window

To open the Render Pipeline Debugger window in the Editor, go to **Window > Analysis > Rendering Debugger**. 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).
To open the Render Pipeline Debugger window in the Editor, go to **Window > Analysis > Rendering Debugger**. 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of information seems useful to have in the core part of the docs as it's common to both pipelines. It should be mentioned in mobile how you can enabled the window at runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Right now, all Rendering Debugger docs are under HDRP as the URP docs are not yet written. I'd like to leave it to @oleks-k to figure out if/how to split the shared "Core" parts of the documentation, and keep HDRP/URP-specific parts under their respective packages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we don't have an efficient way to reuse the doc content between packages.
I'll copy this into to URP, and after 2021.2 will think of a way to reuse content (this is a tooling limitation).


You can display read-only items such as the FPS counter independently of the **Render Pipeline Debugger** window. This means that when you disable the **Render Pipeline Debugger** 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.

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.

### Navigation at runtime

To change the current active item:
Expand Down