mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
avoid serialization data loss when in no-sprite mode (#4756)
This commit is contained in:
@@ -479,6 +479,12 @@ export class ButtonComponent extends Component {
|
||||
this.node.on('spriteframe-changed', (comp: SpriteComponent) => {
|
||||
if (this._transition === Transition.SPRITE) {
|
||||
this._normalSprite = comp.spriteFrame;
|
||||
} else {
|
||||
// avoid serialization data loss when in no-sprite mode
|
||||
this._normalSprite = null;
|
||||
this._hoverSprite = null;
|
||||
this._pressedSprite = null;
|
||||
this._disabledSprite = null;
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user