private void DetachChild(CCNode child, bool doCleanup) { // IMPORTANT: // -1st do onExit // -2nd cleanup if (m_bIsRunning) { child.OnExitTransitionDidStart(); child.OnExit(); } // If you don't do cleanup, the child's actions will not get removed and the // its scheduledSelectors_ dict will not get released! if (doCleanup) { child.Cleanup(); } // set parent nil at the end child.Parent = null; m_pChildren.Remove(child); }