Raanan Weber 7 年之前
父節點
當前提交
1fd90e1926
共有 1 個文件被更改,包括 4 次插入2 次删除
  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);