Cocostdio 场景编辑器 导入后只要获取UI控件 就白屏 停止工作

Cocostdio 场景编辑器 导入后只要获取UI控件 就白屏 马上停止工作 怎么回事啊 2dx 3.0 3.2 都这样

Node* node = SceneReader::getInstance()->createNodeWithSceneFile(“NewScene.json”);
this->addChild(node, 1);
ComRender* render = (ComRender*)node->getChildByTag(10005)->getComponent(“GUIComponent”);
Widget* getbutton = (Widget*)render->getNode();
Button* button = (Button*)getbutton->getChildByName(“Button”);
button->addTouchEventListener(this, toucheventselector(NewGame::buttonCallBack));

只留前两句 就正常 请问 是怎么回事 ?

是 运行窗口白了

如果是仅仅保留前两句就正常,要么是你代码写错了,要么是你导入的资源路径错了。
1.查看你得到的值是否为NULL,如果是,则是路径导出错误了。
2.除了保留前两句的代码,删除其他后。增加:auto xx = static_cast<Button*>(rootnode ->getchildybyname(“button”));

检查你是否添加了scrollview 或者 listview,并设置了裁切内容,我猜可能是裁剪造成的