diff --git a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs index ff0a6aa02e..56b566c41d 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs @@ -185,11 +185,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var mapEditorMenu = widget.Get("MAP_EDITOR_MENU"); mapEditorMenu.IsVisible = () => menuType == MenuType.MapEditor; - var onSelect = new Action(uid => - { - RemoveShellmapUI(); - LoadMapIntoEditor(modData.MapCache[uid].Uid); - }); + // Loading into the map editor + Game.BeforeGameStart += RemoveShellmapUI; + + var onSelect = new Action(uid => LoadMapIntoEditor(modData.MapCache[uid].Uid)); var newMapButton = widget.Get("NEW_MAP_BUTTON"); newMapButton.OnClick = () => @@ -450,7 +449,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic protected override void Dispose(bool disposing) { if (disposing) + { Game.OnRemoteDirectConnect -= OnRemoteDirectConnect; + Game.BeforeGameStart -= RemoveShellmapUI; + } + base.Dispose(disposing); } }