瀏覽代碼

Fix wrong effect when callin getEffect from a onBindObservable

Popov72 5 年之前
父節點
當前提交
555e2e4ac7
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/Materials/shaderMaterial.ts

+ 4 - 0
src/Materials/shaderMaterial.ts

@@ -796,7 +796,11 @@ export class ShaderMaterial extends Material {
             }
         }
 
+        const seffect = this._effect;
+
+        this._effect = effect; // make sure the active effect is the right one if there are some observers for onBind that would need to get the current effect
         this._afterBind(mesh);
+        this._effect = seffect;
     }
 
     protected _afterBind(mesh?: Mesh): void {