Skip to content

Commit dad9d1f

Browse files
committed
Add editor window and menu item for displaying the current MRTK version
1 parent c436a84 commit dad9d1f

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
using Microsoft.MixedReality.Toolkit.Utilities.Editor;
5+
using System;
6+
using UnityEditor;
7+
using UnityEngine;
8+
9+
namespace Microsoft.MixedReality.Toolkit.Editor
10+
{
11+
internal class MRTKVersionPopup : EditorWindow
12+
{
13+
private static MRTKVersionPopup window;
14+
private static readonly Version MRTKVersion = typeof(MixedRealityToolkit).Assembly.GetName().Version;
15+
private static readonly Vector2 WindowSize = new Vector2(300, 150);
16+
private static readonly GUIContent Title = new GUIContent("Mixed Reality Toolkit");
17+
18+
[MenuItem("Mixed Reality/Toolkit/Show version...")]
19+
private static void Init()
20+
{
21+
if (window != null)
22+
{
23+
window.Close();
24+
}
25+
26+
window = CreateInstance<MRTKVersionPopup>();
27+
window.titleContent = Title;
28+
window.maxSize = WindowSize;
29+
window.minSize = WindowSize;
30+
window.ShowUtility();
31+
}
32+
33+
private void OnGUI()
34+
{
35+
using (new EditorGUILayout.VerticalScope())
36+
{
37+
MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();
38+
39+
using (new EditorGUILayout.HorizontalScope())
40+
{
41+
GUILayout.FlexibleSpace();
42+
EditorGUILayout.LabelField($"Version {MRTKVersion}", EditorStyles.wordWrappedLabel);
43+
GUILayout.FlexibleSpace();
44+
}
45+
}
46+
}
47+
}
48+
}

Assets/MRTK/Core/Inspectors/Setup/MRTKVersionPopup.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)