环境: cocos2d-x + lua 3.0beta2
首先声明全局变量
UIEventDispatcher = cc.EventDispatcher:new()
然后在使用的地方dispathCustomEvent
UIEventDispatcher:dispatchCustomEvent("test","test")
但是抛出如题的错误
查看此时 UIEventDispatcher ~= nil
如果在声明的地方马上调用,就没有问题,难道是否自动释放了
在声明的下面加上一句 UIEventDispatcher:retain()
看来是cocos2d-x的自动释放机制
具体原因,待查