Explorar o código

dispose vrHelper when scene is disposed

Trevor Baron %!s(int64=7) %!d(string=hai) anos
pai
achega
bc94fba93f
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      src/Cameras/VR/babylon.vrExperienceHelper.ts

+ 4 - 0
src/Cameras/VR/babylon.vrExperienceHelper.ts

@@ -310,6 +310,10 @@ module BABYLON {
             scene.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete);
             window.addEventListener('vrdisplaypresentchange', this._onVrDisplayPresentChange);
 
+            scene.onDisposeObservable.add(()=>{
+                this.dispose();
+            })
+
             // Gamepad connection events
             this._webVRCamera.onControllerMeshLoadedObservable.add((webVRController) => this._onDefaultMeshLoaded(webVRController));
             this._scene.gamepadManager.onGamepadConnectedObservable.add((pad) => this._onNewGamepadConnected(pad));