forked from microsoft/MixedRealityToolkit-Unity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DiagnosticsDemoControls.cs
50 lines (43 loc) · 1.53 KB
/
DiagnosticsDemoControls.cs
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
48
49
50
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.MixedReality.Toolkit.Diagnostics;
using Microsoft.MixedReality.Toolkit.Utilities;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
{
public class DiagnosticsDemoControls : MonoBehaviour
{
private IMixedRealityDiagnosticsSystem diagnosticsSystem = null;
private IMixedRealityDiagnosticsSystem DiagnosticsSystem
{
get
{
if (diagnosticsSystem == null)
{
MixedRealityServiceRegistry.TryGetService<IMixedRealityDiagnosticsSystem>(out diagnosticsSystem);
}
return diagnosticsSystem;
}
}
private async void Start()
{
await new WaitUntil(() => DiagnosticsSystem != null);
// Ensure the diagnostic visualizations are turned on.
DiagnosticsSystem.ShowDiagnostics = true;
}
/// <summary>
/// Shows or hides all enabled diagnostics.
/// </summary>
public void OnToggleDiagnostics()
{
DiagnosticsSystem.ShowDiagnostics = !DiagnosticsSystem.ShowDiagnostics;
}
/// <summary>
/// Shows or hides the profiler display.
/// </summary>
public void OnToggleProfiler()
{
DiagnosticsSystem.ShowProfiler = !DiagnosticsSystem.ShowProfiler;
}
}
}