cocoStudio中编辑的场景中的UI控件在lua程序中如何获取

    local s_node = SceneReader:sharedSceneReader():createNodeWithSceneFile("publish/FishJoy2.json")

    local s_ui = s_node:getChildByTag(10010)
    local s_component = s_ui:getComponent("GUIComponent")


    local s_ul = s_component:getNode()


    --local s_ul = s_component:Render()

如上代码 在 getNode() 或者 Render() 时报错没有函数… 打印 s_component 获取正常的userdata类型。

好像不行,你看下是否有提供lua的接口

一直getChildByTag就可以了。层级关系如下:
scene
|— 匿名Layer
|— ui

所以,代码大致如下:

local s_node = SceneReader:sharedSceneReader():createNodeWithSceneFile(“publish/FishJoy2.json”)
local s_uilayer = s_node:getChildByTag(10010) ---- 参数是你在场景里面 给ui结点分配的tag
local s_ui = s_uilayer:getChildByTag(1) ---- 参数是你的UI根结点的tag