Skip to content

Commit 9086324

Browse files
committed
Update MixedRealityProjectConfiguratorWindow.cs
1 parent f088209 commit 9086324

File tree

1 file changed

+63
-65
lines changed

1 file changed

+63
-65
lines changed

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

Lines changed: 63 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class MixedRealityProjectConfiguratorWindow : EditorWindow
2121
private const float Default_Window_Width = 300.0f;
2222
private const string XRPipelineDocsUrl = "TO DO";
2323
private const string XRSDKUnityDocsUrl = "https://docs.unity3d.com/Manual/configuring-project-for-xr.html";
24+
private const string MSOpenXRPluginUrl = "https://aka.ms/openxr-unity-install";
2425
private readonly GUIContent ApplyButtonContent = new GUIContent("Apply", "Apply configurations to this Unity Project");
2526
private readonly GUIContent SkipButtonContent = new GUIContent("Skip", "Skip to next step");
2627
private readonly GUIContent LaterButtonContent = new GUIContent("Later", "Do not show this pop-up notification until next session");
@@ -187,34 +188,38 @@ private void RenderNoPipeline()
187188
Repaint();
188189
}
189190
EditorGUILayout.LabelField("XR Pipeline Setting", EditorStyles.boldLabel);
190-
EditorGUILayout.LabelField("To build applications targeting AR/VR headsets you need to specify an XR pipeline. "
191+
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to specify an XR pipeline. "
191192
#if UNITY_2019_3_OR_NEWER
192-
+ $"Unity currently provides the following pipelines in this version ({Application.unityVersion}). Please choose the one you would like to use. "
193+
+ $"Unity currently provides the following pipelines in this version ({Application.unityVersion}). Please choose the one you would like to use:"
194+
+ $"\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."
195+
+ $"\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."
193196
#else
194-
+$"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. "
197+
+$"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.). "
195198
#endif // UNITY_2019_3_OR_NEWER
196-
+ "You may also skip this step and configure manually later. "
197-
+ $"More information can be found at {XRPipelineDocsUrl}", EditorStyles.wordWrappedLabel);
199+
+ "\n\n\nYou may also skip this step and configure manually later.", EditorStyles.wordWrappedLabel);
198200
CreateSpace(15);
199201
using (new EditorGUILayout.HorizontalScope())
200202
{
201203
#if UNITY_2019_3_OR_NEWER
202-
if (GUILayout.Button("Legacy XR"))
204+
if (GUILayout.Button("Legacy XR (Recommended)"))
203205
#else
204206
if (GUILayout.Button("Enable Legacy XR"))
205207
#endif // UNITY_2019_3_OR_NEWER
206208

207209
{
208210
XRSettingsUtilities.LegacyXREnabled = true;
209211
}
210-
211212
#if UNITY_2019_3_OR_NEWER
212-
if (GUILayout.Button("XR SDK/XR Management (Recommended)"))
213+
if (GUILayout.Button("XR SDK/XR Management"))
213214
{
215+
if (!XRSettingsUtilities.XRManagementPresent)
216+
{
217+
AddUPMPackage("com.unity.xr.management");
218+
}
214219
currentStage = ConfigurationStage.InstallBuiltinPlugin;
215220
Repaint();
216221
}
217-
#endif
222+
#endif // UNITY_2019_3_OR_NEWER
218223
if (GUILayout.Button("Learn more"))
219224
{
220225
Application.OpenURL(XRPipelineDocsUrl);
@@ -229,9 +234,9 @@ private void RenderNoPipeline()
229234
private void RenderLegacyXRPipelineDetected()
230235
{
231236
EditorGUILayout.LabelField("XR Pipeline Setting - LegacyXR in use", EditorStyles.boldLabel);
232-
EditorGUILayout.LabelField("To build applications targeting AR/VR headsets you need to specify an XR pipeline. "
237+
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to specify an XR pipeline. "
233238
+ $"\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."
234-
+ $"\n\nFor more information on alternative pipelines, please visit {XRPipelineDocsUrl}", EditorStyles.wordWrappedLabel);
239+
+ $"\n\nFor more information on alternative pipelines, please click on the Learn more button.", EditorStyles.wordWrappedLabel);
235240
CreateSpace(15);
236241
using (new EditorGUILayout.HorizontalScope())
237242
{
@@ -251,9 +256,9 @@ private void RenderLegacyXRPipelineDetected()
251256
private void RenderMicrosoftOpenXRPipelineDetected()
252257
{
253258
EditorGUILayout.LabelField("XR Pipeline Setting - XR SDK with Unity + Microsoft OpenXR plugins in use", EditorStyles.boldLabel);
254-
EditorGUILayout.LabelField("To build applications targeting AR/VR headsets you need to specify an XR pipeline. "
259+
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to specify an XR pipeline. "
255260
+ $"\n\nThe XR SDK pipeline with Unity and Microsoft OpenXR plugins are detected in the project. You are good to go."
256-
+ $"\n\nFor more information on alternative pipelines, please visit {XRPipelineDocsUrl}", EditorStyles.wordWrappedLabel);
261+
+ $"\n\nFor more information on alternative pipelines, please click on the Learn more button.", EditorStyles.wordWrappedLabel);
257262
CreateSpace(15);
258263
using (new EditorGUILayout.HorizontalScope())
259264
{
@@ -274,10 +279,10 @@ private void RenderMicrosoftOpenXRPipelineDetected()
274279
private void RenderOpenXRPipelineDetected()
275280
{
276281
EditorGUILayout.LabelField("XR Pipeline Setting - XR SDK with Unity OpenXR plugin in use", EditorStyles.boldLabel);
277-
EditorGUILayout.LabelField("To build applications targeting AR/VR headsets you need to specify an XR pipeline. "
282+
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to specify an XR pipeline. "
278283
+ $"\n\nThe XR SDK pipeline with Unity OpenXR plugin is detected in the project. You are good to go."
279-
+ $"\n\nNote: If you are targeting HoloLens 2 or HP Reverb G2 headset you need to click on the more info button and follow the instructions there."
280-
+ $"\n\nFor more information on alternative pipelines, please visit {XRPipelineDocsUrl}", EditorStyles.wordWrappedLabel);
284+
+ $"\n\nNote: If you are targeting HoloLens 2 or HP Reverb G2 headset you need to install the Microsoft OpenXR plugin."
285+
+ $"\n\nFor more information on alternative pipelines, please click on the Learn more button.", EditorStyles.wordWrappedLabel);
281286
CreateSpace(15);
282287
using (new EditorGUILayout.HorizontalScope())
283288
{
@@ -286,7 +291,7 @@ private void RenderOpenXRPipelineDetected()
286291
currentStage = ConfigurationStage.ProjectConfiguration;
287292
Repaint();
288293
}
289-
if (GUILayout.Button("More info on HoloLens 2 and Reverb G2"))
294+
if (GUILayout.Button("Install Microsoft OpenXR plugin..."))
290295
{
291296
currentStage = ConfigurationStage.InstallMSOpenXR;
292297
Repaint();
@@ -302,10 +307,10 @@ private void RenderOpenXRPipelineDetected()
302307

303308
private void RenderXRSDKBuiltinPluginPipelineDetected()
304309
{
305-
EditorGUILayout.LabelField("XR Pipeline Setting - XR SDK with builtin plugin in use", EditorStyles.boldLabel);
306-
EditorGUILayout.LabelField("To build applications targeting AR/VR headsets you need to specify an XR pipeline. "
307-
+ $"\n\nThe XR SDK pipeline with builtin plugin is detected in the project. You are good to go."
308-
+ $"\n\nFor more information on alternative pipelines, please visit {XRPipelineDocsUrl}", EditorStyles.wordWrappedLabel);
310+
EditorGUILayout.LabelField("XR Pipeline Setting - XR SDK with builtin plugin (non-OpenXR) in use", EditorStyles.boldLabel);
311+
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to specify an XR pipeline. "
312+
+ $"\n\nThe XR SDK pipeline with builtin plugin (non-OpenXR) is detected in the project. You are good to go."
313+
+ $"\n\nFor more information on alternative pipelines, please click on the Learn more button.", EditorStyles.wordWrappedLabel);
309314
CreateSpace(15);
310315
using (new EditorGUILayout.HorizontalScope())
311316
{
@@ -330,26 +335,31 @@ private void RenderSelectXRSDKPlugin()
330335
Repaint();
331336
}
332337
EditorGUILayout.LabelField("XR Pipeline Setting - Enabling the XR SDK Pipeline", EditorStyles.boldLabel);
333-
EditorGUILayout.LabelField("To build applications targeting AR/VR headsets you need to enable an XR pipeline. "
334-
+ "With this pipeline there are two categories of provider plugins for the XR SDK pipeline:"
335-
+ $"\n\nThe Unity OpenXR plugin (possibly along with vender-specific extension plugins) is recommended if you are targeting HoloLens 2 and/or Windows Mixed Reality (WMR) headsets."
336-
+ "\nThe built-in plugins provided by Unity offers a wide range of supported devices, including HoloLens 2 and WMR headsets. "
337-
+ $"\n\nMore information can be found at {XRPipelineDocsUrl}.", EditorStyles.wordWrappedLabel);
338+
EditorGUILayout.LabelField("To build applications for AR/VR headsets you need to enable an XR pipeline. "
339+
+ "With the XR SDK pipeline there are two categories of provider plugins:"
340+
+ $"\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."
341+
+ "\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."
342+
+ $"\n\nFor more information, please click on the Learn more button.", EditorStyles.wordWrappedLabel);
338343
CreateSpace(15);
339344
using (new EditorGUILayout.HorizontalScope())
340345
{
341-
if (GUILayout.Button("Use the Unity OpenXR plugin"))
346+
if (GUILayout.Button("Use the Unity OpenXR plugin (recommended)"))
342347
{
343348

344349
#if UNITY_2020_2_OR_NEWER
345-
var request = UnityEditor.PackageManager.Client.Add("com.unity.xr.openxr");
346-
while (!request.IsCompleted) { }
350+
AddUPMPackage("com.unity.xr.openxr");
347351
currentStage = ConfigurationStage.InstallOpenXR;
348352
#endif // UNITY_2020_2_OR_NEWER
349353
Repaint();
350354
}
351-
if (GUILayout.Button("Use built-in Unity plugins"))
355+
if (GUILayout.Button("Use built-in Unity plugins (non-OpenXR)"))
352356
{
357+
#if UNITY_2019_3_OR_NEWER
358+
if (!XRSettingsUtilities.XRManagementPresent)
359+
{
360+
AddUPMPackage("com.unity.xr.management");
361+
}
362+
#endif // UNITY_2019_3_OR_NEWER
353363
currentStage = ConfigurationStage.InstallBuiltinPlugin;
354364
Repaint();
355365
}
@@ -371,40 +381,21 @@ private void RenderEnableXRSDKBuiltinPlugin()
371381
currentStage = ConfigurationStage.Init;
372382
Repaint();
373383
}
374-
EditorGUILayout.LabelField("XR Pipeline Setting - Enabling the XR SDK Pipeline with built-in Plugins", EditorStyles.boldLabel);
384+
EditorGUILayout.LabelField("XR Pipeline Setting - Enabling the XR SDK Pipeline with built-in Plugins (non-OpenXR)", EditorStyles.boldLabel);
375385

376-
if (XRSettingsUtilities.XRManagementPresent)
377-
{
378-
EditorGUILayout.LabelField("To enable the XR SDK pipeline with built-in Plugins, first press the Show Settings button. "
379-
+ $"\n\nIn the XR management plug-in window that shows up, check the plugin(s) you want to use based on your target device. "
380-
+ "\n\nBe sure to switch to the correct build target (e.g. UWP, Windows standalone) tab first by clicking on the icon(s) right below the XR Plug-in Management title. "
381-
+ $"After checking the desired plugin(s) click on the Next button to continue."
382-
+ $"\n\nMore information can be found at {XRSDKUnityDocsUrl} (Only the first three steps are needed if following instructions on the page)", EditorStyles.wordWrappedLabel);
383-
}
384-
else
385-
{
386-
EditorGUILayout.LabelField("To enable the XR SDK pipeline with built-in Plugins, first press the Show Settings button. "
387-
+ $"\n\nIn the XR management plug-in window that shows up, click on the install XR Plugin Management button. "
388-
+ "After clicking on that button, please check the plugin(s) you want to use based on your target device. "
389-
+ "\n\nBe sure to switch to the correct build target (e.g. UWP, Windows standalone) tab first by clicking on the icon(s) right below the XR Plug-in Management title. "
390-
+ $"After checking the desired plugin(s) click on the Next button to continue."
391-
+ $"\n\nMore information can be found at {XRSDKUnityDocsUrl} (Only the first three steps are needed if following instructions on the page)", EditorStyles.wordWrappedLabel);
392-
}
386+
EditorGUILayout.LabelField("To enable the XR SDK pipeline with built-in Plugins (non-OpenXR), follow the steps below:"
387+
+ "\n\n1. Press the Show Settings button."
388+
+ "\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. "
389+
+ "\n3. Check the plugin(s) you want to use based on your target device. "
390+
+ "\n\nA new page confirming the setup is successful will be shown in place of this page once you finish the steps."
391+
+ $"\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);
393392

394393
CreateSpace(15);
395394
using (new EditorGUILayout.HorizontalScope())
396395
{
397396
if (GUILayout.Button("Show Settings"))
398397
{
399-
400-
if (XRSettingsUtilities.XRManagementPresent)
401-
{
402-
SettingsService.OpenProjectSettings("Project/XR Plug-in Management");
403-
}
404-
else
405-
{
406-
SettingsService.OpenProjectSettings("Project/XR Plugin Management");
407-
}
398+
SettingsService.OpenProjectSettings("Project/XR Plug-in Management");
408399
}
409400
if (GUILayout.Button("Learn more"))
410401
{
@@ -448,17 +439,17 @@ private void RenderEnableMicrosoftOpenXRPlugin()
448439
currentStage = ConfigurationStage.Init;
449440
Repaint();
450441
}
451-
EditorGUILayout.LabelField("XR Pipeline Setting - Configurating OpenXR for HoloLens 2 and HP Reverb G2", EditorStyles.boldLabel);
442+
EditorGUILayout.LabelField("XR Pipeline Setting - Installing the Microsoft OpenXR plugin", EditorStyles.boldLabel);
452443

453-
EditorGUILayout.LabelField("To target HoloLens 2 or HP Reverb G2 headset you need to follow the instructions below."
454-
+ $"\n\nFirst click on the Show XR Plug-in Management Settings button. In the window popping up/getting focus, switch to switch to the correct build target (i.e. UWP or Windows standalone) tab "
455-
+ "by clicking on the icon(s) right below the XR Plug-in Management title. Then you should hover on the question mark to the right of the \"Enable HoloLens 2 feature set\" chekcbox and follow the instructions there."
456-
+ "\n\nNote: Follow the \"Manual setup without MRTK\" section of the instructions on the web page as MRTK is already in the project. Also you do not need to manually select MRTK in the feature tool no matter it is shown as installed or not."
457-
+ "\n\nKeep this window and the Unity project open during the process. A new page confirming the setup is successful will be shown in place of this page once you finish the steps.", EditorStyles.wordWrappedLabel);
444+
EditorGUILayout.LabelField("To target HoloLens 2 or HP Reverb G2 headset you need to install the Microsoft OpenXR plugin by following the instructions below."
445+
+ "\n\n1. Press the Show instructions button."
446+
+ "\n2. Follow the instructions in the Manual setup without MRTK section as MRTK is already in the project. Also you do not need to manually select MRTK in the feature tool no matter it is shown as installed or not."
447+
+ "\n3. Keep this window and the Unity project open during the process. A new page confirming the setup is successful will be shown in place of this page once you finish the steps."
448+
, EditorStyles.wordWrappedLabel);
458449
CreateSpace(15);
459-
if (GUILayout.Button("Show XR Plug-in Management Settings"))
450+
if (GUILayout.Button("Show instructions"))
460451
{
461-
SettingsService.OpenProjectSettings("Project/XR Plug-in Management");
452+
Application.OpenURL(MSOpenXRPluginUrl);
462453
}
463454
RenderSetupLaterSection(true, () => {
464455
currentStage = ConfigurationStage.ProjectConfiguration;
@@ -869,5 +860,12 @@ private void CreateSpace(float width)
869860
}
870861
#endif // UNITY_2019_3_OR_NEWER
871862
}
863+
#if UNITY_2019_3_OR_NEWER
864+
private void AddUPMPackage(string packageName)
865+
{
866+
var request = UnityEditor.PackageManager.Client.Add(packageName);
867+
while (!request.IsCompleted) { }
868+
}
869+
#endif
872870
}
873871
}

0 commit comments

Comments
 (0)