Label 赋值字体后没有改变

this.loadingTxt = this.node.getChildByName(“loadingTxt”);
this.loadingTxt.string = “he”;
cc.log("loadingPage… “+this.loadingTxt.string+” "+this.loadingTxt);

我这样显示loadingTxt 为什么 字不会显示 “he”
log打印出来的是"he"

你取错对象了呗,要取到节点上的label组件:this.node.getChildByName(“loadingTxt”).getComponent(cc.Label);

getChildByName 取到的是Node类型的对象。
this.loadingTxt.string = “he”; 是在给node的string变量赋值,所以能log出来。
creator中,label类型是component组件,依附于node,所以你需要node.getComponent(cc.Label);

明白了 谢谢

谢谢 明白了