cocos2d-x 3.0 scene的退出

来源:互联网 发布:webpack windows路径 编辑:程序博客网 时间:2024/05/04 14:06

看了一份flappy bird的代码,运行时发现,点击关闭按钮,就会出现Assert: Node still marked as running on node destruction! Was base class onExit() called in derived class onExit() implementations?。跟踪调试后发现是onExit()时出了问题。在自定义的Scene类中重载了onExit().

网上的解决方案:http://blog.csdn.net/shun_fzll/article/details/23531959 中的3楼

1. 去掉onExit();

2. 在重载的onExit()中加上Scene::onExit();

另外 http://forum.cocos2d-swift.org/t/how-to-properly-clean-up-scene-onexit/10001 说引擎的framwork会做好相关组件的释放工作,无需重载onExit,除非想保存一些数据信息。

0 0
原创粉丝点击