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 {