Skip to content

Commit 402fc71

Browse files
MaxWang-MSRogPodgekeveleigh
committed
Update MixedRealityProjectConfiguratorWindow.cs
Co-Authored-By: RogPodge <[email protected]> Co-Authored-By: Kurtis <[email protected]>
1 parent 701fec5 commit 402fc71

File tree

1 file changed

+85
-67
lines changed

1 file changed

+85
-67
lines changed

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

Lines changed: 85 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ public class MixedRealityProjectConfiguratorWindow : EditorWindow
2222
private const string XRPipelineDocsUrl = "Pipeline docs not yet available";
2323
private const string XRSDKUnityDocsUrl = "https://docs.unity3d.com/Manual/configuring-project-for-xr.html";
2424
private const string MSOpenXRPluginUrl = "https://aka.ms/openxr-unity-install";
25+
private const string XRPipelineIntro = "To build applications for AR/VR headsets you need to enable an XR pipeline. ";
26+
private const string AlternativePipelineText = "\n\nFor more information on alternative pipelines, please click on the Learn More button.";
2527
private readonly GUIContent ApplyButtonContent = new GUIContent("Apply", "Apply configurations to this Unity Project");
2628
private readonly GUIContent SkipButtonContent = new GUIContent("Skip", "Skip to next step");
2729
private readonly GUIContent LaterButtonContent = new GUIContent("Later", "Do not show this pop-up notification until next session");
2830
private readonly GUIContent IgnoreButtonContent = new GUIContent("Ignore", "Modify this preference under Edit > Project Settings > Mixed Reality Toolkit");
31+
private GUIStyle multiLineButtonStyle;
2932

3033
private static ConfigurationStage currentStage
3134
{
@@ -51,7 +54,6 @@ private void OnEnable()
5154
#else
5255
CompilationPipeline.assemblyCompilationStarted += CompilationPipeline_compilationStarted;
5356
#endif // UNITY_2019_3_OR_NEWER
54-
5557
MixedRealityProjectConfigurator.SelectedSpatializer = SpatializerUtilities.CurrentSpatializer;
5658
}
5759

@@ -113,12 +115,18 @@ private void OnGUI()
113115
MixedRealityInspectorUtility.RenderMixedRealityToolkitLogo();
114116
if (currentStage != ConfigurationStage.Done)
115117
{
116-
EditorGUILayout.LabelField("Welcome to MRTK!", MixedRealityStylesUtility.BoldLargeTitleStyle);
118+
GUILayout.Label("Welcome to MRTK!", MixedRealityStylesUtility.BoldLargeTitleStyle);
117119
CreateSpace(5);
118120
EditorGUILayout.LabelField("This configurator will go through some settings to make sure the project is ready for MRTK.");
119121
CreateSpace(20);
120122
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
121123
}
124+
multiLineButtonStyle = new GUIStyle("button")
125+
{
126+
richText = true,
127+
wordWrap = true,
128+
alignment = TextAnchor.MiddleLeft
129+
};
122130

123131

124132
switch (currentStage)
@@ -195,43 +203,51 @@ private void RenderNoPipeline()
195203
Repaint();
196204
}
197205
EditorGUILayout.LabelField("XR Pipeline Setting", EditorStyles.boldLabel);
198-
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to specify an XR pipeline. "
199-
#if UNITY_2019_3_OR_NEWER
200-
+ $"Unity currently provides the following pipelines in this version ({Application.unityVersion}). Please choose the one you would like to use:"
201-
+ $"\n\nLegacy XR (Recommended) - Choose this if you want maximum stability and are willing to spend more effort when upgrading the project to Unity 2020. Supports HoloLens, Windows Mixed Reality/OpenVR/Oculus headset."
202-
+ $"\n\nXR SDK/XR Management - Choose this if you want to have a smoother upgrade path to Unity 2020. Supports HoloLens, Windows Mixed Reality/Oculus/Magic Leap headset. Note: do NOT choose this if you anticipate using Azure Spatial Anchors as there is a known compatibility issue."
206+
EditorGUILayout.LabelField(XRPipelineIntro
207+
#if !UNITY_2019_3_OR_NEWER
208+
+ $"Unity currently provides the Legacy XR pipeline in this version ({Application.unityVersion}). Please click on the Enable Legacy XR button if you are targeting AR/VR headsets (e.g. HoloLens, Windows Mixed Reality headset, OpenVR headset etc.). "
203209
#else
204-
+$"Unity currently provides the Legacy XR pipeline in this version ({Application.unityVersion}). Please click on the Enable Legacy XR button if you are targeting AR/VR headsets (e.g. HoloLens, Windows Mixed Reality headset, OpenVR headset etc.). "
210+
+ $"Unity currently provides the following pipelines in this version ({Application.unityVersion}). Please choose the one you would like to use. "
205211
#endif // UNITY_2019_3_OR_NEWER
206-
+ "\n\n\nYou may also skip this step and configure manually later.", EditorStyles.wordWrappedLabel);
212+
+ "You may also skip this step and configure manually later.", EditorStyles.wordWrappedLabel);
213+
#if !UNITY_2019_3_OR_NEWER
207214
CreateSpace(15);
208215
using (new EditorGUILayout.HorizontalScope())
209216
{
210-
#if UNITY_2019_3_OR_NEWER
211-
if (GUILayout.Button("Legacy XR (Recommended)"))
212-
#else
213217
if (GUILayout.Button("Enable Legacy XR"))
214-
#endif // UNITY_2019_3_OR_NEWER
215-
216218
{
217219
XRSettingsUtilities.LegacyXREnabled = true;
218220
}
219-
#if UNITY_2019_3_OR_NEWER
220-
if (GUILayout.Button("XR SDK/XR Management"))
221+
if (GUILayout.Button("Learn More"))
221222
{
222-
if (!XRSettingsUtilities.XRManagementPresent)
223-
{
224-
AddUPMPackage("com.unity.xr.management");
225-
}
226-
currentStage = ConfigurationStage.InstallBuiltinPlugin;
227-
Repaint();
223+
Application.OpenURL(XRPipelineDocsUrl);
228224
}
229-
#endif // UNITY_2019_3_OR_NEWER
230-
if (GUILayout.Button("Learn more"))
225+
}
226+
#else
227+
CreateSpace(15);
228+
229+
if (GUILayout.Button("\n<b>Legacy XR (recommended)</b><size=4>\n\n</size>"
230+
+ "Choose this if you want maximum stability and are willing to spend more effort when upgrading the project to Unity 2020. Supports HoloLens and Windows Mixed Reality/OpenVR headsets.\n", multiLineButtonStyle))
231+
{
232+
XRSettingsUtilities.LegacyXREnabled = true;
233+
}
234+
if (GUILayout.Button("\n<b>XR SDK/XR Management</b><size=4>\n\n</size>"
235+
+ "Choose this if you want to have a smoother upgrade path to Unity 2020. Supports HoloLens and Windows Mixed Reality/Oculus headsets. Note: do NOT choose this if you anticipate using Azure Spatial Anchors as there is a known compatibility issue.\n", multiLineButtonStyle))
236+
{
237+
if (!XRSettingsUtilities.XRManagementPresent)
231238
{
232-
Application.OpenURL(XRPipelineDocsUrl);
239+
AddUPMPackage("com.unity.xr.management");
233240
}
241+
currentStage = ConfigurationStage.InstallBuiltinPlugin;
242+
Repaint();
243+
}
244+
CreateSpace(15);
245+
if (GUILayout.Button("Learn More"))
246+
{
247+
Application.OpenURL(XRPipelineDocsUrl);
234248
}
249+
#endif // !UNITY_2019_3_OR_NEWER
250+
235251
RenderSetupLaterSection(true, () => {
236252
currentStage = ConfigurationStage.ProjectConfiguration;
237253
Repaint();
@@ -241,9 +257,9 @@ private void RenderNoPipeline()
241257
private void RenderLegacyXRPipelineDetected()
242258
{
243259
EditorGUILayout.LabelField("XR Pipeline Setting - LegacyXR in use", EditorStyles.boldLabel);
244-
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to specify an XR pipeline. "
260+
EditorGUILayout.LabelField(XRPipelineIntro
245261
+ $"\n\nThe LegacyXR pipeline is detected in the project. Please be aware that the LegacyXR pipeline is deprecated in Unity 2019 and is removed in Unity 2020."
246-
+ $"\n\nFor more information on alternative pipelines, please click on the Learn more button.", EditorStyles.wordWrappedLabel);
262+
+ AlternativePipelineText, EditorStyles.wordWrappedLabel);
247263
CreateSpace(15);
248264
using (new EditorGUILayout.HorizontalScope())
249265
{
@@ -252,7 +268,7 @@ private void RenderLegacyXRPipelineDetected()
252268
currentStage = ConfigurationStage.ProjectConfiguration;
253269
Repaint();
254270
}
255-
if (GUILayout.Button("Learn more"))
271+
if (GUILayout.Button("Learn More"))
256272
{
257273
Application.OpenURL(XRPipelineDocsUrl);
258274
}
@@ -263,9 +279,9 @@ private void RenderLegacyXRPipelineDetected()
263279
private void RenderMicrosoftOpenXRPipelineDetected()
264280
{
265281
EditorGUILayout.LabelField("XR Pipeline Setting - XR SDK with Unity + Microsoft OpenXR plugins in use", EditorStyles.boldLabel);
266-
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to specify an XR pipeline. "
282+
EditorGUILayout.LabelField(XRPipelineIntro
267283
+ $"\n\nThe XR SDK pipeline with Unity and Microsoft OpenXR plugins are detected in the project. You are good to go."
268-
+ $"\n\nFor more information on alternative pipelines, please click on the Learn more button.", EditorStyles.wordWrappedLabel);
284+
+ AlternativePipelineText, EditorStyles.wordWrappedLabel);
269285
CreateSpace(15);
270286
using (new EditorGUILayout.HorizontalScope())
271287
{
@@ -274,7 +290,7 @@ private void RenderMicrosoftOpenXRPipelineDetected()
274290
currentStage = ConfigurationStage.ProjectConfiguration;
275291
Repaint();
276292
}
277-
if (GUILayout.Button("Learn more"))
293+
if (GUILayout.Button("Learn More"))
278294
{
279295
Application.OpenURL(XRPipelineDocsUrl);
280296
}
@@ -286,10 +302,10 @@ private void RenderMicrosoftOpenXRPipelineDetected()
286302
private void RenderOpenXRPipelineDetected()
287303
{
288304
EditorGUILayout.LabelField("XR Pipeline Setting - XR SDK with Unity OpenXR plugin in use", EditorStyles.boldLabel);
289-
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to specify an XR pipeline. "
305+
EditorGUILayout.LabelField(XRPipelineIntro
290306
+ $"\n\nThe XR SDK pipeline with Unity OpenXR plugin is detected in the project. You are good to go."
291307
+ $"\n\nNote: If you are targeting HoloLens 2 or HP Reverb G2 headset you need to install the Microsoft OpenXR plugin."
292-
+ $"\n\nFor more information on alternative pipelines, please click on the Learn more button.", EditorStyles.wordWrappedLabel);
308+
+ AlternativePipelineText, EditorStyles.wordWrappedLabel);
293309
CreateSpace(15);
294310
using (new EditorGUILayout.HorizontalScope())
295311
{
@@ -303,7 +319,7 @@ private void RenderOpenXRPipelineDetected()
303319
currentStage = ConfigurationStage.InstallMSOpenXR;
304320
Repaint();
305321
}
306-
if (GUILayout.Button("Learn more"))
322+
if (GUILayout.Button("Learn More"))
307323
{
308324
Application.OpenURL(XRPipelineDocsUrl);
309325
}
@@ -315,9 +331,9 @@ private void RenderOpenXRPipelineDetected()
315331
private void RenderXRSDKBuiltinPluginPipelineDetected()
316332
{
317333
EditorGUILayout.LabelField("XR Pipeline Setting - XR SDK with builtin plugin (non-OpenXR) in use", EditorStyles.boldLabel);
318-
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to specify an XR pipeline. "
334+
EditorGUILayout.LabelField(XRPipelineIntro
319335
+ $"\n\nThe XR SDK pipeline with builtin plugin (non-OpenXR) is detected in the project. You are good to go."
320-
+ $"\n\nFor more information on alternative pipelines, please click on the Learn more button.", EditorStyles.wordWrappedLabel);
336+
+ AlternativePipelineText, EditorStyles.wordWrappedLabel);
321337
CreateSpace(15);
322338
using (new EditorGUILayout.HorizontalScope())
323339
{
@@ -326,7 +342,7 @@ private void RenderXRSDKBuiltinPluginPipelineDetected()
326342
currentStage = ConfigurationStage.ProjectConfiguration;
327343
Repaint();
328344
}
329-
if (GUILayout.Button("Learn more"))
345+
if (GUILayout.Button("Learn More"))
330346
{
331347
Application.OpenURL(XRPipelineDocsUrl);
332348
}
@@ -342,39 +358,41 @@ private void RenderSelectXRSDKPlugin()
342358
Repaint();
343359
}
344360
EditorGUILayout.LabelField("XR Pipeline Setting - Enabling the XR SDK Pipeline", EditorStyles.boldLabel);
345-
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to enable an XR pipeline. "
346-
+ "With the XR SDK pipeline there are two categories of provider plugins:"
347-
+ $"\n\nUnity OpenXR plugin (recommended) - Choose this if you want to embrace the new industry standard and easily support a wide range of AR/VR devices in the future! Currently officially supports HoloLens 2 and Windows Mixed Reality headsets with other devices coming soon."
348-
+ "\nBuilt-in Unity plugin (non-OpenXR) - Choose this if your application needs to support platforms beyond just HoloLens 2 and Windows Mixed Reality headsets (e.g. needs to support Oculus/Magic Leap headsets) today."
349-
+ $"\n\nFor more information, please click on the Learn more button.", EditorStyles.wordWrappedLabel);
361+
EditorGUILayout.LabelField(XRPipelineIntro
362+
+ "With the XR SDK pipeline there are two categories of provider plugins:", EditorStyles.wordWrappedLabel);
350363
CreateSpace(15);
351-
using (new EditorGUILayout.HorizontalScope())
364+
365+
if (GUILayout.Button("\n<b>Unity OpenXR plugin (recommended)</b><size=4>\n\n</size>"
366+
+ "Choose this if you want to embrace the new industry standard and easily support a wide range of AR/VR devices in the future! Currently officially supports HoloLens 2 and Windows Mixed Reality headsets with other devices coming soon.\n", multiLineButtonStyle))
352367
{
353-
if (GUILayout.Button("Use the Unity OpenXR plugin (recommended)"))
354-
{
355368

356369
#if UNITY_2020_2_OR_NEWER
357-
AddUPMPackage("com.unity.xr.openxr");
358-
currentStage = ConfigurationStage.InstallOpenXR;
370+
AddUPMPackage("com.unity.xr.openxr");
371+
currentStage = ConfigurationStage.InstallOpenXR;
359372
#endif // UNITY_2020_2_OR_NEWER
360-
Repaint();
361-
}
362-
if (GUILayout.Button("Use built-in Unity plugins (non-OpenXR)"))
363-
{
373+
Repaint();
374+
}
375+
CreateSpace(15);
376+
if (GUILayout.Button("\n<b>Built-in Unity plugins (non-OpenXR)</b><size=4>\n\n</size>"
377+
+ "Choose this if your application needs to support platforms beyond just HoloLens 2 and Windows Mixed Reality headsets (e.g. needs to support Oculus/Magic Leap headsets) today.\n", multiLineButtonStyle))
378+
{
364379
#if UNITY_2019_3_OR_NEWER
365-
if (!XRSettingsUtilities.XRManagementPresent)
366-
{
367-
AddUPMPackage("com.unity.xr.management");
368-
}
369-
#endif // UNITY_2019_3_OR_NEWER
370-
currentStage = ConfigurationStage.InstallBuiltinPlugin;
371-
Repaint();
372-
}
373-
if (GUILayout.Button("Learn more"))
380+
if (!XRSettingsUtilities.XRManagementPresent)
374381
{
375-
Application.OpenURL(XRPipelineDocsUrl);
382+
AddUPMPackage("com.unity.xr.management");
376383
}
384+
#endif // UNITY_2019_3_OR_NEWER
385+
currentStage = ConfigurationStage.InstallBuiltinPlugin;
386+
Repaint();
387+
}
388+
CreateSpace(25);
389+
EditorGUILayout.LabelField("For more information, please click on the Learn More button.", EditorStyles.wordWrappedLabel);
390+
CreateSpace(15);
391+
if (GUILayout.Button("Learn More"))
392+
{
393+
Application.OpenURL(XRPipelineDocsUrl);
377394
}
395+
378396
RenderSetupLaterSection(true, () => {
379397
currentStage = ConfigurationStage.ProjectConfiguration;
380398
Repaint();
@@ -395,7 +413,7 @@ private void RenderEnableXRSDKBuiltinPlugin()
395413
+ "\n2. In the XR management plug-in window that shows up, switch to the current build target (e.g. UWP, Windows standalone) tab by clicking on the corresponding icon right below the XR Plug-in Management title. "
396414
+ "\n3. Check the plugin(s) you want to use based on your target device. "
397415
+ "\n\nA new page confirming the setup is successful will be shown in place of this page once you finish the steps."
398-
+ $"\n\nFor more information, please click on the Learn more button. (Only the first three steps are needed if following instructions on the page)", EditorStyles.wordWrappedLabel);
416+
+ $"\n\nFor more information, please click on the Learn More button. (Only the first three steps are needed if following instructions on the page)", EditorStyles.wordWrappedLabel);
399417

400418
CreateSpace(15);
401419
using (new EditorGUILayout.HorizontalScope())
@@ -404,7 +422,7 @@ private void RenderEnableXRSDKBuiltinPlugin()
404422
{
405423
SettingsService.OpenProjectSettings("Project/XR Plug-in Management");
406424
}
407-
if (GUILayout.Button("Learn more"))
425+
if (GUILayout.Button("Learn More"))
408426
{
409427
Application.OpenURL(XRSDKUnityDocsUrl);
410428
}
@@ -572,10 +590,10 @@ private void RenderShowUPMExamples()
572590

573591
private void RenderConfigurationCompleted()
574592
{
575-
EditorGUILayout.LabelField("MRTK Setup Completed!", MixedRealityStylesUtility.BoldLargeTitleStyle);
593+
GUILayout.Label("MRTK Setup Completed!", MixedRealityStylesUtility.BoldLargeTitleStyle);
576594
CreateSpace(5);
577595
EditorGUILayout.LabelField("You have finished setting up the project for Mixed Reality Toolkit. You may go through this process again by clicking on Mixed Reality (menu bar) -> Toolkit -> Utilities -> Configure Project for MRTK"
578-
+ $"\n\nIf there are certain settings not set according to the recommendation you may see this configurator popping up again. You may use the Ignore or Later button to suppress the behavior. "
596+
+ $"\n\nIf there are certain settings not set according to the recommendation you may see this configurator pops up again. Use the Ignore or Later button to suppress this behavior. "
579597
+ "\n\nWe hope you enjoy using MRTK. Please find the links to our documentation and API references below. If you encountered something looking like a bug please report by opening an issue in our repository. "
580598
+ "\n\nThese links are accessible through Mixed Reality (menu bar) -> Toolkit -> Help.", EditorStyles.wordWrappedLabel);
581599
CreateSpace(15);
@@ -603,7 +621,7 @@ private void RenderSetupLaterSection(bool showSkipButton = false, Action skipBut
603621
EditorGUILayout.LabelField("Not ready to setup the project now?", EditorStyles.boldLabel);
604622

605623
EditorGUILayout.LabelField(showSkipButton ? "You may choose to skip this step, delay the setup until next session or ignore the setup unless reenabled." :
606-
"You may choose to delay the setup until next session or ignore the setup unless reenabled."
624+
"You may choose to setup the project in the next session or ignore the setup for future sessions."
607625
, EditorStyles.wordWrappedLabel);
608626
CreateSpace(15);
609627
using (new EditorGUILayout.HorizontalScope())
@@ -779,7 +797,7 @@ public void RenderConfigurations()
779797
}
780798
}
781799

782-
public void ApplyConfigurations()
800+
private void ApplyConfigurations()
783801
{
784802
var configurationFilter = new HashSet<MRConfig>();
785803
foreach (var item in trackToggles)

0 commit comments

Comments
 (0)