Procházet zdrojové kódy

Fix wrong effect when callin getEffect from a onBindObservable

Popov72 před 5 roky
rodič
revize
555e2e4ac7
1 změnil soubory, kde provedl 4 přidání a 0 odebrání
  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 {