소스 검색

add warning indicating that the scene should be ready before serializing the dynamic texture

Kacey Coley 7 년 전
부모
커밋
a7193c619e
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      src/Materials/Textures/babylon.dynamicTexture.ts

+ 6 - 1
src/Materials/Textures/babylon.dynamicTexture.ts

@@ -179,10 +179,15 @@
         }
 
         /**
-         * Serializes the dynamic texture
+         * Serializes the dynamic texture.  The scene should be ready before the dynamic texture is serialized
          * @returns a serialized dynamic texture object
          */
         public serialize(): any {
+            const scene = this.getScene();
+            if (scene && !scene.isReady()) {
+                Tools.Warn("The scene must be ready before serializing the dynamic texture");
+            }
+
             const serializationObject = super.serialize();
             serializationObject.base64String = this._canvas.toDataURL();