// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Utilities; using UnityEngine; using UnityEngine.Serialization; namespace Microsoft.MixedReality.Toolkit.Diagnostics { /// /// Configuration profile settings for setting up diagnostics. /// [CreateAssetMenu(menuName = "Mixed Reality/Toolkit/Profiles/Mixed Reality Diagnostics Profile", fileName = "MixedRealityDiagnosticsProfile", order = (int)CreateProfileMenuItemIndices.Diagnostics)] [MixedRealityServiceProfile(typeof(IMixedRealityDiagnosticsSystem))] [HelpURL("https://docs.microsoft.com/windows/mixed-reality/mrtk-unity/features/diagnostics/diagnostics-system-getting-started")] public class MixedRealityDiagnosticsProfile : BaseMixedRealityProfile { [SerializeField] [FormerlySerializedAs("visible")] [Tooltip("Display all enabled diagnostics")] private bool showDiagnostics = true; /// /// Show or hide diagnostic visualizations. /// public bool ShowDiagnostics => showDiagnostics; [SerializeField] [Tooltip("Display profiler")] private bool showProfiler = true; /// /// Show or hide the profiler UI. /// public bool ShowProfiler => showProfiler; [SerializeField] [Tooltip("Display the frame info (per frame stats).")] private bool showFrameInfo = true; /// /// Show or hide the frame info (per frame stats). /// public bool ShowFrameInfo => showFrameInfo; [SerializeField] [Tooltip("Display the memory stats (used, peak, and limit).")] private bool showMemoryStats = true; /// /// Show or hide the memory stats (used, peak, and limit). /// public bool ShowMemoryStats => showMemoryStats; [SerializeField] [FormerlySerializedAs("frameRateDuration")] [Tooltip("The amount of time, in seconds, to collect frames for frame rate calculation.")] [Range(0, 5)] private float frameSampleRate = 0.1f; /// /// The amount of time, in seconds, to collect frames for frame rate calculation. /// public float FrameSampleRate => frameSampleRate; [SerializeField] [Tooltip("What part of the view port to anchor the window to.")] private TextAnchor windowAnchor = TextAnchor.LowerCenter; /// /// What part of the view port to anchor the window to. /// public TextAnchor WindowAnchor => windowAnchor; [SerializeField] [Tooltip("The offset from the view port center applied based on the window anchor selection.")] private Vector2 windowOffset = new Vector2(0.1f, 0.1f); /// /// The offset from the view port center applied based on the window anchor selection. /// public Vector2 WindowOffset => windowOffset; [SerializeField] [Tooltip("Use to scale the window size up or down, can simulate a zooming effect.")] private float windowScale = 1.0f; /// /// Use to scale the window size up or down, can simulate a zooming effect. /// public float WindowScale => windowScale; [SerializeField] [Tooltip("How quickly to interpolate the window towards its target position and rotation.")] private float windowFollowSpeed = 5.0f; /// /// How quickly to interpolate the window towards its target position and rotation. /// public float WindowFollowSpeed => windowFollowSpeed; [SerializeField] [Tooltip("A material that the diagnostics system can use to render objects with instanced color support.")] private Material defaultInstancedMaterial = null; /// /// A material that the diagnostics system can use to render objects with instanced color support. /// A asset reference is required here to make sure the shader permutation is pulled into player builds. /// public Material DefaultInstancedMaterial => defaultInstancedMaterial; [SerializeField] [Tooltip("If the diagnostics profiler should be visible while a mixed reality capture is happening on HoloLens.")] private bool showProfilerDuringMRC = false; /// /// If the diagnostics profiler should be visible while a mixed reality capture is happening on HoloLens. /// /// This is not usually recommended, as MRC can have an effect on an app's frame rate. public bool ShowProfilerDuringMRC => showProfilerDuringMRC; } }