Pārlūkot izejas kodu

Fix wrong effect when callin getEffect from a onBindObservable

Popov72 5 gadi atpakaļ
vecāks
revīzija
555e2e4ac7
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  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 {