public void PopCockpit(bool bDestroy) { if (activeCockpit != null) { inputBehaviors.Remove(activeCockpit.InputBehaviors); overrideBehaviors.Remove(activeCockpit.OverrideBehaviors); activeCockpit.RootGameObject.SetActive(false); if (bDestroy) { activeCockpit.Destroy(); } activeCockpit = null; } activeCockpit = cockpitStack.Pop(); if (activeCockpit != null) { activeCockpit.RootGameObject.SetActive(true); inputBehaviors.Add(activeCockpit.InputBehaviors); overrideBehaviors.Add(activeCockpit.OverrideBehaviors); } mouseCursor.ResetCursorToCenter(); }