avoid serialization data loss when in no-sprite mode (#4756)

This commit is contained in:
JoneLau
2019-07-01 09:41:06 +08:00
committed by Weiliang Wang
parent 261f6a15c4
commit d159a539b2
@@ -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);
}