/// <summary> /// Removes a screen from the screen manager. You should normally use /// <see cref="GameScreen"/>.ExitScreen instead of calling this directly, so the screen can /// gradually "transition off" rather than just being instantly removed. /// </summary> public void RemoveScreen(GameScreen screen) { // If we have a graphics device, tell the screen to unload content. if ((_graphicsDeviceService != null) && (_graphicsDeviceService.GraphicsDevice != null)) { screen.UnloadContent(); } // Remove the screen from the arrays lock (_screens) _screens.Remove(screen); lock (_screensToUpdate) _screensToUpdate.Remove(screen); }