[C#] [NativeUI] Deleting a sub-menu at runtime?
-
Hi guys, I want to delete a sub-menu at runtime. Is it possible to do it? Any help would be appreciated.
-
Can't you simply not run
var submenu = myMenu.AddSubMenu(menu, "MenuToDelete")
and anything that depends onsubmenu
?In the examples, simply having an
if(thing) { AddMenuAnotherMenu(mainMenu); }
would probably do what you're asking.
-
Yes, But I think he means having the ability to actually remove it. If a condition is true, remove a menu that's already been added.
I see there is AddSubMenu, but is there a way to if(condition) { myMenu.RemoveSubMenu) ?
-
I haven't used NativeUI, but try RemoveItemAt with the index of your submenu. You'll need to call RefreshIndex after. (Dynamic add/remove menu items)