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
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#if ENABLE_INPUT_SYSTEM && ENABLE_INPUT_SYSTEM_PACKAGE
#define USE_INPUT_SYSTEM
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
#endif

using System.Collections.Generic;
Expand Down Expand Up @@ -250,6 +249,30 @@ internal float GetAction(DebugAction action)
return m_DebugActionStates[(int)action].actionState;
}

internal bool GetActionToggleDebugMenuWithTouch()
{
#if USE_INPUT_SYSTEM
var touches = InputSystem.EnhancedTouch.Touch.activeTouches;
var touchCount = touches.Count;
const InputSystem.TouchPhase touchPhaseBegan = InputSystem.TouchPhase.Began;
#else
var touches = Input.touches;
var touchCount = Input.touchCount;
const TouchPhase touchPhaseBegan = TouchPhase.Began;
#endif
if (touchCount == 3)
{
foreach (var touch in touches)
{
// Gesture: 3-finger double-tap
if (touch.phase == touchPhaseBegan && touch.tapCount == 2)
return true;
}
}

return false;
}

void RegisterInputs()
{
#if UNITY_EDITOR
Expand Down
30 changes: 18 additions & 12 deletions com.unity.render-pipelines.core/Runtime/Debugging/DebugUpdater.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#if ENABLE_INPUT_SYSTEM && ENABLE_INPUT_SYSTEM_PACKAGE
#define USE_INPUT_SYSTEM
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.UI;
using UnityEngine.InputSystem.EnhancedTouch;
#endif
using UnityEngine.EventSystems;

namespace UnityEngine.Rendering
Expand All @@ -17,7 +23,17 @@ static void RuntimeInit()
if (es == null)
{
go.AddComponent<EventSystem>();
#if USE_INPUT_SYSTEM
// FIXME: InputSystemUIInputModule has a quirk where the default actions fail to get initialized if the
// component is initialized while the GameObject is active. So we deactivate it temporarily.
// See https://fogbugz.unity3d.com/f/cases/1323566/
go.SetActive(false);
go.AddComponent<InputSystemUIInputModule>();
go.SetActive(true);
EnhancedTouchSupport.Enable();
#else
go.AddComponent<StandaloneInputModule>();
#endif
}
DontDestroyOnLoad(go);
}
Expand All @@ -28,21 +44,11 @@ void Update()

debugManager.UpdateActions();

if (debugManager.GetAction(DebugAction.EnableDebugMenu) != 0.0f)
if (debugManager.GetAction(DebugAction.EnableDebugMenu) != 0.0f ||
debugManager.GetActionToggleDebugMenuWithTouch())
{
debugManager.displayRuntimeUI = !debugManager.displayRuntimeUI;
}
else
{
if (Input.touchCount == 3)
{
foreach (var touch in Input.touches)
{
if (touch.phase == TouchPhase.Began)
debugManager.displayRuntimeUI = !debugManager.displayRuntimeUI;
}
}
}

if (debugManager.displayRuntimeUI && debugManager.GetAction(DebugAction.ResetAll) != 0.0f)
{
Expand Down