Sfoglia il codice sorgente

revert to component

Trevor Baron 6 anni fa
parent
commit
d506aa643c
1 ha cambiato i file con 8 aggiunte e 6 eliminazioni
  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 {