From e1a2a369780f215758a62c25484bd86495bbded9 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Mon, 9 Jun 2025 15:02:43 -0500 Subject: [PATCH] Add GetOrAddButton utility for MainMenu. --- Source/Editor/GUI/MainMenu.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Source/Editor/GUI/MainMenu.cs b/Source/Editor/GUI/MainMenu.cs index 0b959d2c9..bce668451 100644 --- a/Source/Editor/GUI/MainMenu.cs +++ b/Source/Editor/GUI/MainMenu.cs @@ -266,6 +266,19 @@ namespace FlaxEditor.GUI return AddChild(new MainMenuButton(text)); } + /// + /// Gets or adds a button. + /// + /// The button text + /// The existing or created button control. + public MainMenuButton GetOrAddButton(string text) + { + MainMenuButton result = GetButton(text); + if (result == null) + result = AddButton(text); + return result; + } + /// /// Gets the button. ///