mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
fix mesh renderer changed bug (#8122)
* 解决了 MeshRender 修改 mesh 后,阴影不正确的 bug * fix ci error
This commit is contained in:
committed by
GitHub
parent
fa2057deb4
commit
d4c2604068
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user