使用早上更新了最近代码编译后的player,进入A场景,然后replace B场景,再replace回A场景,此时A场景里所有child都无法响应touch了。看了下源码,应该是在替换场景时,A场景执行了cleanUp方法
void CCScene::cleanup(void)
{
m_touchableNodes->removeAllObjects();
m_touchingTargets->removeAllObjects();
CCDirector::sharedDirector()->getTouchDispatcher()->removeDelegate(this);
CCLayer::cleanup();
}
```
其中CCDirector::sharedDirector()->getTouchDispatcher()->removeDelegate(this);将触摸事件给注销额。。。
测试代码如下
scripts.zip (3 KB)