import { _decorator, Component, Node,Label } from 'cc'; const { ccclass, property } = _decorator; @ccclass('UpdateScore') export class UpdateScore extends Component { public static instance:UpdateScore=null; private totalScore:number=0; start() { UpdateScore.instance=this; this.node.getComponent(Label).string='0'; } update(deltaTime: number) { } public Update_Score(score:number){ this.totalScore+=score; this.node.getComponent(Label).string=this.totalScore.toString(); } }