10 lines
282 B
TypeScript
Raw Normal View History

2022-08-26 16:48:17 +08:00
const { ccclass, requireComponent } = cc._decorator;
@ccclass
@requireComponent(cc.Sprite)
export default class ShaderGray extends cc.Component {
onLoad() {
this.getComponent(cc.Sprite).setMaterial(0, cc.Material.getBuiltinMaterial('2d-gray-sprite'));
}
}