Raanan Weber 7 lat temu
rodzic
commit
1fd90e1926
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      src/babylon.scene.ts

+ 4 - 2
src/babylon.scene.ts

@@ -1927,7 +1927,9 @@
         private _executeOnceBeforeRender(func: () => void): void {
             let execFunc = () => {
                 func();
-                this.unregisterBeforeRender(execFunc);
+                setTimeout(() => {
+                    this.unregisterBeforeRender(execFunc);
+                });
             }
             this.registerBeforeRender(execFunc);
         }
@@ -1940,7 +1942,7 @@
          * @param timeout optional delay in ms
          */
         public executeOnceBeforeRender(func: () => void, timeout?: number): void {
-            if (typeof timeout === 'number') {
+            if (timeout !== undefined) {
                 setTimeout(() => {
                     this._executeOnceBeforeRender(func);
                 }, timeout);