Bläddra i källkod

Merge pull request #7791 from RaananW/exit-vr-fix

exit allowed only if already in XR
mergify[bot] 5 år sedan
förälder
incheckning
2187aa039a
2 ändrade filer med 5 tillägg och 0 borttagningar
  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

@@ -50,6 +50,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))
 - Fix improper baking of transformed textures in `KHR_texture_transform` serializer. ([drigax](https://github.com/Drigax))
 - Fixed NME codegen: missing common properties for float-value input block. ([ycw](https://github.com/ycw))
 

+ 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();
     }