forked from microsoft/MixedRealityToolkit-Unity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToggleDebugWindow.cs
More file actions
47 lines (42 loc) · 1.3 KB
/
ToggleDebugWindow.cs
File metadata and controls
47 lines (42 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using UnityEngine;
using HoloToolkit.Unity.InputModule;
namespace HoloToolkit.Unity
{
/// <summary>
/// Toggles if the debug window is visible or not.
/// </summary>
public class ToggleDebugWindow : MonoBehaviour, IInputClickHandler
{
/// <summary>
/// Current state of the debug window.
/// </summary>
private bool debugEnabled = false;
/// <summary>
/// The debug window.
/// </summary>
public GameObject DebugWindow;
private void Start()
{
UpdateChildren();
}
/// <summary>
/// When the user clicks this control, we toggle the state of the DebugWindow
/// </summary>
/// <param name="eventData"></param>
public void OnInputClicked(InputClickedEventData eventData)
{
debugEnabled = !debugEnabled;
UpdateChildren();
eventData.Use();
}
/// <summary>
/// Sets the debugwindow's active flag to debugEnabled.
/// </summary>
private void UpdateChildren()
{
DebugWindow.SetActive(debugEnabled);
}
}
}