我在cocos studio建了一个lua工程,添加了一个按钮名字叫"Button_1" .发布后在src\app\views 目录下 的MainScene.lua文件中添加了如下的代码,为什么红色的代码部分总是获取为NIL?请大神帮我解答下 版本 2.2.9
local MainScene = class(“MainScene”, cc.load(“mvc”).ViewBase)
MainScene.RESOURCE_FILENAME = “MainScene.csb”
function MainScene:onCreate()
local root = self:getResourceNode()
local node = root:getChildByName("Button_1")
if node == nil then
release_print("node is nil!!")
end
local function onPlay()
end
end
return MainScene