why call UILayer::removeFromParent?


#1

void UIScene::previousCallback(CCObject* sender, TouchEventType type) { if (type == TOUCH_EVENT_ENDED) { m_pUiLayer->unscheduleUpdate(); m_pUiLayer->removeFromParent(); CCDirector::sharedDirector()->replaceScene(UISceneManager::sharedUISceneManager()->previousUIScene()); } }

If handle replaceScene, current scene will remove all child node in it including UILayer, why call removeFromParent here?