Explorar o código

exit allowed only if in XR

Raanan Weber %!s(int64=5) %!d(string=hai) anos
pai
achega
23f371fbe7
Modificáronse 2 ficheiros con 5 adicións e 0 borrados
  1. 1 0
      dist/preview release/what's new.md
  2. 4 0
      src/XR/webXRExperienceHelper.ts

+ 1 - 0
dist/preview release/what's new.md

@@ -43,6 +43,7 @@
 - Fix NME Frames bug where collapsing and moving a frame removed the nodes inside ([Kyle Belfort](https://github.com/belfortk)
 - Fix moving / disappearing controls when freezing/unfreezing the ScrollViewer ([Popov72](https://github.com/Popov72)
 - Fix: when using instances, master mesh (if displayed) does not have correct instance buffer values ([Popov72](https://github.com/Popov72)
+- Exit XR will only trigger only if state is IN_XR ([RaananW](https://github.com/RaananW))
 
 
 ## Breaking changes

+ 4 - 0
src/XR/webXRExperienceHelper.ts

@@ -174,6 +174,10 @@ export class WebXRExperienceHelper implements IDisposable {
      * @returns promise that resolves after xr mode has exited
      */
     public exitXRAsync() {
+        // only exit if state is IN_XR
+        if (this.state !== WebXRState.IN_XR) {
+            return Promise.resolve();
+        }
         this._setState(WebXRState.EXITING_XR);
         return this.sessionManager.exitXRAsync();
     }