看了一份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.youkuaiyun.com/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,除非想保存一些数据信息。
本文解决了FlappyBird游戏中点击关闭按钮导致的Assert错误:Nodestillmarkedasrunningonnodedestruction。通过调整自定义Scene类中onExit()方法的实现方式来解决此问题,并讨论了引擎框架对组件释放的处理。
1248

被折叠的 条评论
为什么被折叠?



