我在mac版的cocostudio里添加了一个“自定义字体”控件。代码是:
LabelBMFont timer = dynamic_cast<LabelBMFont>(rootNode->getChildByName(“timer”));
但得到的timer却是NULL。
但是当我不转类型的时候:Node *timer = rootNode->getChildByName(“timer”);
timer不是NULL, 我想应该是转为LabelBMFont时出的问题。但studio和json里显示的这个控件的类型确实是LabelBMFont,可为什么得到的是NULL呢?是引擎本身的问题吗?
已解决。在cocos2d-x3.2中,LabelBMFont已被TextBMFont代替了。但mac版本的studio导出的json里仍用着LabelBMFont的名字。