这些代码没报错,但无法改变Label组件的string,请问问题出在哪里?
properties: {
ScorePrefab : {
default : null,
type : cc.Prefab,
},
},
onLoad: function () {
var ScoreLabel = cc.instantiate(this.ScorePrefab);
this.node.addChild(ScoreLabel);
ScoreLabel.setPosition(0,0);
this.ScoreLabel = ScoreLabel;
window.Score = 0;
},
update: function () {
if(...) {
window.Score += 1;
this.ScoreLabel.string = 'Score: ' + window.Score.toString();
}
},
感觉像是这一行写错了this.ScoreLabel.string = 'Score: ’ + window.Score.toString();
请问正确的代码写法是什么?