fix mesh renderer changed bug (#8122)

* 解决了 MeshRender 修改 mesh 后,阴影不正确的 bug

* fix ci error
This commit is contained in:
troublemaker52025
2021-01-12 15:16:57 +08:00
committed by GitHub
parent fa2057deb4
commit d4c2604068
+4 -2
View File
@@ -222,13 +222,15 @@ export class MeshRenderer extends RenderableComponent {
set mesh (val) {
const old = this._mesh;
this._mesh = val;
this._mesh?.initialize();
if (this._mesh) { this._mesh.initialize(); }
this._watchMorphInMesh();
this._onMeshChanged(old);
this._updateModels();
if (this.enabledInHierarchy) {
this._attachToScene();
}
this._updateCastShadow();
this._updateReceiveShadow();
}
get model () {
@@ -266,7 +268,7 @@ export class MeshRenderer extends RenderableComponent {
}
public onLoad () {
this._mesh?.initialize();
if (this._mesh) { this._mesh.initialize(); }
this._watchMorphInMesh();
this._updateModels();
this._updateCastShadow();