BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / Oculus / VR / Editor / OVRPluginUpdater.cs

OVRPluginUpdater.cs

Project Import
timfa Tim Falken · pushed by timfa · 6 years ago
b77834a1 History
OVRPluginUpdater.cs 20.3 KiB Download Raw
1/************************************************************************************
2
3Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
4
5Licensed under the Oculus SDK License Version 3.4.1 (the "License");
6you may not use the Oculus SDK except in compliance with the License,
7which is provided at the time of installation or download, or which
8otherwise accompanies this software in either electronic or hard copy form.
9
10You may obtain a copy of the License at
11
12https://developer.oculus.com/licenses/sdk-3.4.1
13
14Unless required by applicable law or agreed to in writing, the Oculus SDK
15distributed under the License is distributed on an "AS IS" BASIS,
16WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17See the License for the specific language governing permissions and
18limitations under the License.
19
20************************************************************************************/
21
22using UnityEngine;
23using UnityEditor;
24using UnityEditor.Callbacks;
25using System;
26using System.Collections.Generic;
27using System.Linq;
28using System.Text.RegularExpressions;
29using System.IO;
30using System.Diagnostics;
31
32[InitializeOnLoad]
33class OVRPluginUpdater
34{
35 enum PluginPlatform
36 {
37 Android,
38 AndroidUniversal,
39 OSXUniversal,
40 Win,
41 Win64,
42 }
43 class PluginPackage
44 {
45 public string RootPath;
46 public System.Version Version;
47 public Dictionary<PluginPlatform, string> Plugins = new Dictionary<PluginPlatform, string>();
48
49 public bool IsBundledPluginPackage()
50 {
51 return (RootPath == GetBundledPluginRootPath());
52 }
53
54 public bool IsEnabled()
55 {
56 // TODO: Check each individual platform rather than using the Win64 DLL status for the overall package status.
57 string path = "";
58 if (Plugins.TryGetValue(PluginPlatform.Win64, out path))
59 {
60 return File.Exists(path);
61 }
62
63 return false;
64 }
65
66 public bool IsAndroidUniversalEnabled()
67 {
68 string path = "";
69 if (Plugins.TryGetValue(PluginPlatform.AndroidUniversal, out path))
70 {
71 if (File.Exists(path))
72 {
73 string basePath = GetCurrentProjectPath();
74 string relPath = path.Substring(basePath.Length + 1);
75
76 PluginImporter pi = PluginImporter.GetAtPath(relPath) as PluginImporter;
77 if (pi != null)
78 {
79 return pi.GetCompatibleWithPlatform(BuildTarget.Android);
80 }
81 }
82 }
83
84 return false;
85 }
86
87 public bool IsAndroidUniversalPresent()
88 {
89 string path = "";
90 if (Plugins.TryGetValue(PluginPlatform.AndroidUniversal, out path))
91 {
92 string disabledPath = path + GetDisabledPluginSuffix();
93
94 if (File.Exists(path) || File.Exists(disabledPath))
95 {
96 return true;
97 }
98 }
99
100 return false;
101 }
102 }
103
104 private static bool restartPending = false;
105 private static bool unityRunningInBatchmode = false;
106 private static bool unityVersionSupportsAndroidUniversal = false;
107 private static bool enableAndroidUniversalSupport = true;
108
109 private static System.Version invalidVersion = new System.Version("0.0.0");
110
111 static OVRPluginUpdater()
112 {
113 EditorApplication.delayCall += OnDelayCall;
114 }
115
116 static void OnDelayCall()
117 {
118 if (System.Environment.CommandLine.Contains("-batchmode"))
119 {
120 unityRunningInBatchmode = true;
121 }
122
123 if (enableAndroidUniversalSupport)
124 {
125#if UNITY_2018_3_OR_NEWER
126 unityVersionSupportsAndroidUniversal = true;
127#endif
128 }
129
130 if (ShouldAttemptPluginUpdate())
131 {
132 AttemptPluginUpdate(true);
133 }
134 }
135
136 private static PluginPackage GetPluginPackage(string rootPath)
137 {
138 return new PluginPackage()
139 {
140 RootPath = rootPath,
141 Version = GetPluginVersion(rootPath),
142 Plugins = new Dictionary<PluginPlatform, string>()
143 {
144 { PluginPlatform.Android, rootPath + GetPluginBuildTargetSubPath(PluginPlatform.Android) },
145 { PluginPlatform.AndroidUniversal, rootPath + GetPluginBuildTargetSubPath(PluginPlatform.AndroidUniversal) },
146 { PluginPlatform.OSXUniversal, rootPath + GetPluginBuildTargetSubPath(PluginPlatform.OSXUniversal) },
147 { PluginPlatform.Win, rootPath + GetPluginBuildTargetSubPath(PluginPlatform.Win) },
148 { PluginPlatform.Win64, rootPath + GetPluginBuildTargetSubPath(PluginPlatform.Win64) },
149 }
150 };
151 }
152
153 private static PluginPackage GetBundledPluginPackage()
154 {
155 return GetPluginPackage(GetBundledPluginRootPath());
156 }
157
158 private static List<PluginPackage> GetAllUtilitiesPluginPackages()
159 {
160 string pluginRootPath = GetUtilitiesPluginRootPath();
161 List<PluginPackage> packages = new List<PluginPackage>();
162
163 if (Directory.Exists(pluginRootPath))
164 {
165 var dirs = Directory.GetDirectories(pluginRootPath);
166
167 foreach(string dir in dirs)
168 {
169 packages.Add(GetPluginPackage(dir));
170 }
171 }
172
173 return packages;
174 }
175
176 private static string GetCurrentProjectPath()
177 {
178 return Directory.GetParent(Application.dataPath).FullName;
179 }
180
181 private static string GetUtilitiesPluginRootPath()
182 {
183 return GetUtilitiesRootPath() + @"/Plugins";
184 }
185
186 private static string GetUtilitiesRootPath()
187 {
188 var so = ScriptableObject.CreateInstance(typeof(OVRPluginUpdaterStub));
189 var script = MonoScript.FromScriptableObject(so);
190 string assetPath = AssetDatabase.GetAssetPath(script);
191 string editorDir = Directory.GetParent(assetPath).FullName;
192 string ovrDir = Directory.GetParent(editorDir).FullName;
193
194 return ovrDir;
195 }
196
197 private static string GetBundledPluginRootPath()
198 {
199 string basePath = EditorApplication.applicationContentsPath;
200 string pluginPath = @"/UnityExtensions/Unity/VR";
201
202 return basePath + pluginPath;
203 }
204
205 private static string GetPluginBuildTargetSubPath(PluginPlatform target)
206 {
207 string path = string.Empty;
208
209 switch (target)
210 {
211 case PluginPlatform.Android:
212 path = @"/Android/OVRPlugin.aar";
213 break;
214 case PluginPlatform.AndroidUniversal:
215 path = @"/AndroidUniversal/OVRPlugin.aar";
216 break;
217 case PluginPlatform.OSXUniversal:
218 path = @"/OSXUniversal/OVRPlugin.bundle";
219 break;
220 case PluginPlatform.Win:
221 path = @"/Win/OVRPlugin.dll";
222 break;
223 case PluginPlatform.Win64:
224 path = @"/Win64/OVRPlugin.dll";
225 break;
226 default:
227 throw new ArgumentException("Attempted GetPluginBuildTargetSubPath() for unsupported BuildTarget: " + target);
228 }
229
230 return path;
231 }
232
233 private static string GetDisabledPluginSuffix()
234 {
235 return @".disabled";
236 }
237
238 private static System.Version GetPluginVersion(string path)
239 {
240 System.Version pluginVersion = invalidVersion;
241
242 try
243 {
244 pluginVersion = new System.Version(Path.GetFileName(path));
245 }
246 catch
247 {
248 pluginVersion = invalidVersion;
249 }
250
251 if (pluginVersion == invalidVersion)
252 {
253 //Unable to determine version from path, fallback to Win64 DLL meta data
254 path += GetPluginBuildTargetSubPath(PluginPlatform.Win64);
255 if (!File.Exists(path))
256 {
257 path += GetDisabledPluginSuffix();
258 if (!File.Exists(path))
259 {
260 return invalidVersion;
261 }
262 }
263
264 FileVersionInfo pluginVersionInfo = FileVersionInfo.GetVersionInfo(path);
265 if (pluginVersionInfo == null || pluginVersionInfo.ProductVersion == null || pluginVersionInfo.ProductVersion == "")
266 {
267 return invalidVersion;
268 }
269
270 pluginVersion = new System.Version(pluginVersionInfo.ProductVersion);
271 }
272
273 return pluginVersion;
274 }
275
276 public static string GetVersionDescription(System.Version version)
277 {
278 bool isVersionValid = (version != invalidVersion);
279 return isVersionValid ? version.ToString() : "(Unknown)";
280 }
281
282 private static bool ShouldAttemptPluginUpdate()
283 {
284 if (unityRunningInBatchmode)
285 {
286 return false;
287 }
288 else
289 {
290 return !UnitySupportsEnabledAndroidPlugin() || (autoUpdateEnabled && !restartPending && !Application.isPlaying);
291 }
292 }
293
294 private static void DisableAllUtilitiesPluginPackages()
295 {
296 List<PluginPackage> allUtilsPluginPkgs = GetAllUtilitiesPluginPackages();
297
298 foreach(PluginPackage pluginPkg in allUtilsPluginPkgs)
299 {
300 foreach(string path in pluginPkg.Plugins.Values)
301 {
302 if ((Directory.Exists(path)) || (File.Exists(path)))
303 {
304 string basePath = GetCurrentProjectPath();
305 string relPath = path.Substring(basePath.Length + 1);
306 string relDisabledPath = relPath + GetDisabledPluginSuffix();
307
308 AssetDatabase.MoveAsset(relPath, relDisabledPath);
309 AssetDatabase.ImportAsset(relDisabledPath, ImportAssetOptions.ForceUpdate);
310 }
311 }
312 }
313
314 AssetDatabase.Refresh();
315 AssetDatabase.SaveAssets();
316 }
317
318 private static void EnablePluginPackage(PluginPackage pluginPkg)
319 {
320 foreach(var kvp in pluginPkg.Plugins)
321 {
322 PluginPlatform platform = kvp.Key;
323 string path = kvp.Value;
324
325 if ((Directory.Exists(path + GetDisabledPluginSuffix())) || (File.Exists(path + GetDisabledPluginSuffix())))
326 {
327 string basePath = GetCurrentProjectPath();
328 string relPath = path.Substring(basePath.Length + 1);
329 string relDisabledPath = relPath + GetDisabledPluginSuffix();
330
331 AssetDatabase.MoveAsset(relDisabledPath, relPath);
332 AssetDatabase.ImportAsset(relPath, ImportAssetOptions.ForceUpdate);
333
334 PluginImporter pi = PluginImporter.GetAtPath(relPath) as PluginImporter;
335 if (pi == null)
336 {
337 continue;
338 }
339
340 // Disable support for all platforms, then conditionally enable desired support below
341 pi.SetCompatibleWithEditor(false);
342 pi.SetCompatibleWithAnyPlatform(false);
343 pi.SetCompatibleWithPlatform(BuildTarget.Android, false);
344 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, false);
345 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, false);
346#if UNITY_2017_3_OR_NEWER
347 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, false);
348#else
349 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, false);
350 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, false);
351 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, false);
352#endif
353
354 switch (platform)
355 {
356 case PluginPlatform.Android:
357 pi.SetCompatibleWithPlatform(BuildTarget.Android, !unityVersionSupportsAndroidUniversal);
358 if (!unityVersionSupportsAndroidUniversal)
359 {
360 pi.SetPlatformData(BuildTarget.Android, "CPU", "ARMv7");
361 }
362 break;
363 case PluginPlatform.AndroidUniversal:
364 pi.SetCompatibleWithPlatform(BuildTarget.Android, unityVersionSupportsAndroidUniversal);
365 break;
366 case PluginPlatform.OSXUniversal:
367#if UNITY_2017_3_OR_NEWER
368 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSX, true);
369#else
370 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXUniversal, true);
371 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel, true);
372 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneOSXIntel64, true);
373#endif
374 pi.SetCompatibleWithEditor(true);
375 pi.SetEditorData("CPU", "AnyCPU");
376 pi.SetEditorData("OS", "OSX");
377 pi.SetPlatformData("Editor", "CPU", "AnyCPU");
378 pi.SetPlatformData("Editor", "OS", "OSX");
379 break;
380 case PluginPlatform.Win:
381 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows, true);
382 pi.SetCompatibleWithEditor(true);
383 pi.SetEditorData("CPU", "X86");
384 pi.SetEditorData("OS", "Windows");
385 pi.SetPlatformData("Editor", "CPU", "X86");
386 pi.SetPlatformData("Editor", "OS", "Windows");
387 break;
388 case PluginPlatform.Win64:
389 pi.SetCompatibleWithPlatform(BuildTarget.StandaloneWindows64, true);
390 pi.SetCompatibleWithEditor(true);
391 pi.SetEditorData("CPU", "X86_64");
392 pi.SetEditorData("OS", "Windows");
393 pi.SetPlatformData("Editor", "CPU", "X86_64");
394 pi.SetPlatformData("Editor", "OS", "Windows");
395 break;
396 default:
397 throw new ArgumentException("Attempted EnablePluginPackage() for unsupported BuildTarget: " + platform);
398 }
399
400 AssetDatabase.ImportAsset(relPath, ImportAssetOptions.ForceUpdate);
401 }
402 }
403
404 AssetDatabase.Refresh();
405 AssetDatabase.SaveAssets();
406 }
407
408 private static readonly string autoUpdateEnabledKey = "Oculus_Utilities_OVRPluginUpdater_AutoUpdate_" + OVRManager.utilitiesVersion;
409 private static bool autoUpdateEnabled
410 {
411 get {
412 return PlayerPrefs.GetInt(autoUpdateEnabledKey, 1) == 1;
413 }
414
415 set {
416 PlayerPrefs.SetInt(autoUpdateEnabledKey, value ? 1 : 0);
417 }
418 }
419
420 [MenuItem("Oculus/Tools/Disable OVR Utilities Plugin")]
421 private static void AttemptPluginDisable()
422 {
423 PluginPackage bundledPluginPkg = GetBundledPluginPackage();
424 List<PluginPackage> allUtilsPluginPkgs = GetAllUtilitiesPluginPackages();
425
426 PluginPackage enabledUtilsPluginPkg = null;
427
428 foreach(PluginPackage pluginPkg in allUtilsPluginPkgs)
429 {
430 if (pluginPkg.IsEnabled())
431 {
432 if ((enabledUtilsPluginPkg == null) || (pluginPkg.Version > enabledUtilsPluginPkg.Version))
433 {
434 enabledUtilsPluginPkg = pluginPkg;
435 }
436 }
437 }
438
439 if (enabledUtilsPluginPkg == null)
440 {
441 if (unityRunningInBatchmode
442#if UNITY_2018_3_OR_NEWER
443 || EditorUtility.DisplayDialog("Disable Oculus Utilities Plugin",
444 "The OVRPlugin included with Oculus Utilities is already disabled."
445 + " The OVRPlugin installed through the Package Manager will continue to be used.\n",
446 "Ok",
447 ""))
448#else
449 || EditorUtility.DisplayDialog("Disable Oculus Utilities Plugin",
450 "The OVRPlugin included with Oculus Utilities is already disabled."
451 + " The OVRPlugin bundled with the Unity Editor will continue to be used.\n\n"
452 + "Bundled version: "
453 + GetVersionDescription(bundledPluginPkg.Version),
454 "Ok",
455 ""))
456#endif
457 {
458 return;
459 }
460 }
461 else
462 {
463 if (unityRunningInBatchmode
464#if UNITY_2018_3_OR_NEWER
465 || EditorUtility.DisplayDialog("Disable Oculus Utilities Plugin",
466 "Do you want to disable the OVRPlugin included with Oculus Utilities and revert to the OVRPlugin installed through the Package Manager?\n\n"
467 + "Current version: " + GetVersionDescription(enabledUtilsPluginPkg.Version),
468 "Yes",
469 "No"))
470#else
471 || EditorUtility.DisplayDialog("Disable Oculus Utilities Plugin",
472 "Do you want to disable the OVRPlugin included with Oculus Utilities and revert to the OVRPlugin bundled with the Unity Editor?\n\n"
473 + "Current version: " + GetVersionDescription(enabledUtilsPluginPkg.Version)
474 + "\nBundled version: " + GetVersionDescription(bundledPluginPkg.Version),
475 "Yes",
476 "No"))
477#endif
478 {
479 DisableAllUtilitiesPluginPackages();
480
481 if (unityRunningInBatchmode
482#if UNITY_2018_3_OR_NEWER
483 || EditorUtility.DisplayDialog("Restart Unity",
484 "Now you will be using the OVRPlugin installed through Package Manager."
485 + "\n\nPlease restart the Unity Editor to complete the update process.",
486 "Restart",
487 "Not Now"))
488#else
489 || EditorUtility.DisplayDialog("Restart Unity",
490 "OVRPlugin has been updated to "
491 + GetVersionDescription(bundledPluginPkg.Version)
492 + ".\n\nPlease restart the Unity Editor to complete the update process."
493#if !UNITY_2017_1_OR_NEWER
494 + " You may need to manually relaunch Unity if you are using Unity 5.6 and higher."
495#endif
496 ,
497 "Restart",
498 "Not Now"))
499#endif
500 {
501 RestartUnityEditor();
502 }
503 }
504 }
505 }
506
507 [MenuItem("Oculus/Tools/Update OVR Utilities Plugin")]
508 private static void RunPluginUpdate()
509 {
510 autoUpdateEnabled = true;
511 AttemptPluginUpdate(false);
512 }
513
514 // Separate entry point needed since "-executeMethod" does not support parameters or default parameter values
515 private static void BatchmodePluginUpdate()
516 {
517 OnDelayCall(); // manually invoke when running editor in batchmode
518 AttemptPluginUpdate(false);
519 }
520
521 private static void AttemptPluginUpdate(bool triggeredByAutoUpdate)
522 {
523 OVRPlugin.SendEvent("attempt_plugin_update_auto", triggeredByAutoUpdate.ToString());
524
525 PluginPackage bundledPluginPkg = GetBundledPluginPackage();
526 List<PluginPackage> allUtilsPluginPkgs = GetAllUtilitiesPluginPackages();
527
528 PluginPackage enabledUtilsPluginPkg = null;
529 PluginPackage newestUtilsPluginPkg = null;
530
531 foreach(PluginPackage pluginPkg in allUtilsPluginPkgs)
532 {
533 if ((newestUtilsPluginPkg == null) || (pluginPkg.Version > newestUtilsPluginPkg.Version))
534 {
535 newestUtilsPluginPkg = pluginPkg;
536 }
537
538 if (pluginPkg.IsEnabled())
539 {
540 if ((enabledUtilsPluginPkg == null) || (pluginPkg.Version > enabledUtilsPluginPkg.Version))
541 {
542 enabledUtilsPluginPkg = pluginPkg;
543 }
544 }
545 }
546
547 bool reenableCurrentPluginPkg = false;
548 PluginPackage targetPluginPkg = null;
549
550 if ((newestUtilsPluginPkg != null) && (newestUtilsPluginPkg.Version > bundledPluginPkg.Version))
551 {
552 if ((enabledUtilsPluginPkg == null) || (enabledUtilsPluginPkg.Version != newestUtilsPluginPkg.Version))
553 {
554 targetPluginPkg = newestUtilsPluginPkg;
555 }
556 }
557 else if ((enabledUtilsPluginPkg != null) && (enabledUtilsPluginPkg.Version < bundledPluginPkg.Version))
558 {
559 targetPluginPkg = bundledPluginPkg;
560 }
561
562 PluginPackage currentPluginPkg = (enabledUtilsPluginPkg != null) ? enabledUtilsPluginPkg : bundledPluginPkg;
563
564 if ((targetPluginPkg == null) && !UnitySupportsEnabledAndroidPlugin())
565 {
566 // Force reenabling the current package to configure the correct android plugin for this unity version.
567 reenableCurrentPluginPkg = true;
568 targetPluginPkg = currentPluginPkg;
569 }
570
571 if (targetPluginPkg == null)
572 {
573 if (!triggeredByAutoUpdate && !unityRunningInBatchmode)
574 {
575#if UNITY_2018_3_OR_NEWER
576 EditorUtility.DisplayDialog("Update Oculus Utilities Plugin",
577 "OVRPlugin is already up to date.\n\nCurrent version: "
578 + GetVersionDescription(currentPluginPkg.Version),
579 "Ok",
580 "");
581#else
582 EditorUtility.DisplayDialog("Update Oculus Utilities Plugin",
583 "OVRPlugin is already up to date.\n\nCurrent version: "
584 + GetVersionDescription(currentPluginPkg.Version) + "\nBundled version: "
585 + GetVersionDescription(bundledPluginPkg.Version),
586 "Ok",
587 "");
588#endif
589 }
590
591 return; // No update necessary.
592 }
593
594 System.Version targetVersion = targetPluginPkg.Version;
595
596 bool userAcceptsUpdate = false;
597
598 if (unityRunningInBatchmode)
599 {
600 userAcceptsUpdate = true;
601 }
602 else
603 {
604 string dialogBody = "Oculus Utilities has detected that a newer OVRPlugin is available."
605 + " Using the newest version is recommended. Do you want to enable it?\n\n"
606 + "Current version: "
607 + GetVersionDescription(currentPluginPkg.Version)
608 + "\nAvailable version: "
609 + targetVersion;
610
611 if (reenableCurrentPluginPkg)
612 {
613 dialogBody = "Oculus Utilities has detected a configuration change that requires re-enabling the current OVRPlugin."
614 + " Do you want to proceed?\n\nCurrent version: "
615 + GetVersionDescription(currentPluginPkg.Version);
616 }
617
618 int dialogResult = EditorUtility.DisplayDialogComplex("Update Oculus Utilities Plugin", dialogBody, "Yes", "No, Don't Ask Again", "No");
619
620 switch (dialogResult)
621 {
622 case 0: // "Yes"
623 userAcceptsUpdate = true;
624 break;
625 case 1: // "No, Don't Ask Again"
626 autoUpdateEnabled = false;
627
628 EditorUtility.DisplayDialog("Oculus Utilities OVRPlugin",
629 "To manually update in the future, use the following menu option:\n\n"
630 + "[Oculus -> Tools -> Update OVR Utilities Plugin]",
631 "Ok",
632 "");
633 return;
634 case 2: // "No"
635 return;
636 }
637 }
638
639 if (userAcceptsUpdate)
640 {
641 DisableAllUtilitiesPluginPackages();
642
643 if (!targetPluginPkg.IsBundledPluginPackage())
644 {
645 EnablePluginPackage(targetPluginPkg);
646 }
647
648 if (unityRunningInBatchmode
649 || EditorUtility.DisplayDialog("Restart Unity",
650 "OVRPlugin has been updated to "
651 + GetVersionDescription(targetPluginPkg.Version)
652 + ".\n\nPlease restart the Unity Editor to complete the update process."
653#if !UNITY_2017_1_OR_NEWER
654 + " You may need to manually relaunch Unity if you are using Unity 5.6 and higher."
655#endif
656 ,
657 "Restart",
658 "Not Now"))
659 {
660 RestartUnityEditor();
661 }
662 }
663 }
664
665 private static bool UnitySupportsEnabledAndroidPlugin()
666 {
667 List<PluginPackage> allUtilsPluginPkgs = GetAllUtilitiesPluginPackages();
668
669 foreach(PluginPackage pluginPkg in allUtilsPluginPkgs)
670 {
671 if (pluginPkg.IsEnabled())
672 {
673 if (pluginPkg.IsAndroidUniversalEnabled() && !unityVersionSupportsAndroidUniversal)
674 {
675 // Android Universal should only be enabled on supported Unity versions since it can prevent app launch.
676 return false;
677 }
678 else if (!pluginPkg.IsAndroidUniversalEnabled() && pluginPkg.IsAndroidUniversalPresent() && unityVersionSupportsAndroidUniversal)
679 {
680 // Android Universal is present and should be enabled on supported Unity versions since ARM64 config will fail otherwise.
681 return false;
682 }
683 }
684 }
685
686 return true;
687 }
688
689 private static void RestartUnityEditor()
690 {
691 if (unityRunningInBatchmode)
692 {
693 EditorApplication.Exit(0);
694 }
695 else
696 {
697 restartPending = true;
698 EditorApplication.OpenProject(GetCurrentProjectPath());
699 }
700 }
701}