Browse Source

Add missing update code for the _material property

Popov72 5 năm trước cách đây
mục cha
commit
c944990175
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      nodeEditor/src/components/preview/previewManager.ts

+ 6 - 1
nodeEditor/src/components/preview/previewManager.ts

@@ -425,7 +425,7 @@ export class PreviewManager {
 
                     const currentScreen = tempMaterial.getBlockByPredicate((block) => block instanceof CurrentScreenBlock);
                     if (currentScreen) {
-                        this._postprocess!.onApplyObservable.add((effect) => {
+                        this._postprocess.onApplyObservable.add((effect) => {
                             effect.setTexture("textureSampler", (currentScreen as CurrentScreenBlock).texture);
                         });
                     }
@@ -449,6 +449,11 @@ export class PreviewManager {
                         }
                     });
                     tempMaterial.createEffectForParticles(this._particleSystem!);
+
+                    if (this._material) {
+                        this._material.dispose();
+                    }
+                    this._material = tempMaterial;
                     break;
                 }