Browse Source

Merge pull request #9217 from RaananW/offlineWebXR

[XR] stay defensive when downloading the motion controller .json file
Raanan Weber 4 năm trước cách đây
mục cha
commit
e46885d58a
1 tập tin đã thay đổi với 9 bổ sung5 xóa
  1. 9 5
      src/XR/webXRInput.ts

+ 9 - 5
src/XR/webXRInput.ts

@@ -106,12 +106,16 @@ export class WebXRInput implements IDisposable {
             WebXRMotionControllerManager.BaseRepositoryUrl = this.options.customControllersRepositoryURL;
         }
 
-        if (!this.options.disableOnlineControllerRepository) {
-            WebXRMotionControllerManager.UseOnlineRepository = true;
+        WebXRMotionControllerManager.UseOnlineRepository = !this.options.disableOnlineControllerRepository;
+        if (WebXRMotionControllerManager.UseOnlineRepository) {
             // pre-load the profiles list to load the controllers quicker afterwards
-            WebXRMotionControllerManager.UpdateProfilesList();
-        } else {
-            WebXRMotionControllerManager.UseOnlineRepository = false;
+            try {
+                WebXRMotionControllerManager.UpdateProfilesList().catch(() => {
+                    WebXRMotionControllerManager.UseOnlineRepository = false;
+                });
+            } catch (e) {
+                WebXRMotionControllerManager.UseOnlineRepository = false;
+            }
         }
     }