FairyEditor里使用插件

我在FairyEditor里使用插件写了如下的代码,
function onPublish(publishHandler)
publishHandler:add_onComplete(function()
fprint("haha")
end)
end
function onDestroy()
end


但点发布的时候报错了

111.png


我看到 https://github.com/fairygui/FairyGUI-Editor/tree/master/plugin/LuaAPI/CS_FairyEditor_PublishHandler.lua  在这个文档API里是有这个接口的,请问新版的编辑器是否移除了这个接口?我用的编辑器版本是2022.1.0p1
已邀请:

谷主

赞同来自:

没有移除。看报错信息是publishHandler是空?不清楚为什么会这样,打印多点信息看看。

ray555

赞同来自:

publishHandler不是空的,这里说的是publishHandler下没有add_onComplete这个方法,我调用publishHandler其它方法没有问题

谷主

赞同来自:

这个LuaAPI我也没细看,但调用方式我查文档不是这样的,看文档:https://github.com/Tencent/xLua/blob/master/Assets/XLua/Doc/XLua%E6%95%99%E7%A8%8B.md
 
调用方法应该是publishHandler:onComplete('+', lua_event_callback)

ray555

赞同来自:

可以了,非常感谢解答

要回复问题请先登录注册