瀏覽代碼

revert to component

Trevor Baron 6 年之前
父節點
當前提交
d506aa643c
共有 1 個文件被更改,包括 8 次插入6 次删除
  1. 8 6
      src/babylon.assetContainer.ts

+ 8 - 6
src/babylon.assetContainer.ts

@@ -65,9 +65,10 @@ module BABYLON {
             this.textures.forEach((o) => {
                 this.scene.addTexture(o);
             });
-            this.effectLayers.forEach((o) => {
-                this.scene.addEffectLayer(o);
-            });
+            
+            for (let component of this.scene._serializableComponents) {
+                component.addFromContainer(this);
+            }
         }
 
         /**
@@ -113,9 +114,10 @@ module BABYLON {
             this.textures.forEach((o) => {
                 this.scene.removeTexture(o);
             });
-            this.effectLayers.forEach((o) => {
-                this.scene.removeEffectLayer(o);
-            });
+            
+            for (let component of this.scene._serializableComponents) {
+                component.removeFromContainer(this);
+            }
         }
 
         private _moveAssets<T>(sourceAssets: T[], targetAssets: T[], keepAssets: T[]): void {