Skip to content

Commit b94fd86

Browse files
committed
Update with a message when the version can't be read
Or otherwise is just the default 0.0.0.0
1 parent e347fd0 commit b94fd86

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ namespace Microsoft.MixedReality.Toolkit.Editor
1010
{
1111
internal class MRTKVersionPopup : EditorWindow
1212
{
13-
private static MRTKVersionPopup window;
13+
private const string DefaultVersion = "0.0.0.0";
14+
private const string NotFoundMessage = "The version could not be read. This is most often due to (and expected when) using MRTK directly from the repo. If you're using an official distribution and seeing this message, please file a GitHub issue!";
1415
private static readonly Version MRTKVersion = typeof(MixedRealityToolkit).Assembly.GetName().Version;
15-
private static readonly Vector2 WindowSize = new Vector2(300, 150);
16+
private static readonly bool FoundVersion = MRTKVersion.ToString() != DefaultVersion;
17+
private static readonly Vector2 WindowSize = new Vector2(300, 140);
18+
private static readonly Vector2 NotFoundWindowSize = new Vector2(300, 175);
1619
private static readonly GUIContent Title = new GUIContent("Mixed Reality Toolkit");
20+
private static MRTKVersionPopup window;
1721

1822
[MenuItem("Mixed Reality/Toolkit/Show version...", priority = int.MaxValue)]
1923
private static void Init()
@@ -26,8 +30,8 @@ private static void Init()
2630

2731
window = CreateInstance<MRTKVersionPopup>();
2832
window.titleContent = Title;
29-
window.maxSize = WindowSize;
30-
window.minSize = WindowSize;
33+
window.maxSize = FoundVersion ? WindowSize : NotFoundWindowSize;
34+
window.minSize = FoundVersion ? WindowSize : NotFoundWindowSize;
3135
window.ShowUtility();
3236
}
3337

@@ -40,7 +44,7 @@ private void OnGUI()
4044
using (new EditorGUILayout.HorizontalScope())
4145
{
4246
GUILayout.FlexibleSpace();
43-
EditorGUILayout.LabelField($"Version {MRTKVersion}", EditorStyles.wordWrappedLabel);
47+
EditorGUILayout.LabelField(FoundVersion ? $"Version {MRTKVersion}" : NotFoundMessage, EditorStyles.wordWrappedLabel);
4448
GUILayout.FlexibleSpace();
4549
}
4650
}

0 commit comments

Comments
 (0)