Download

Interface Widget: Build at element level or section level?

I have right now two pawns for the character to control. One is for a level editor, and the other is for the player. Each have different UI’s so for these I’ve separated the player and editor UI. Within the editor UI there is a ‘mouse lock’ section with different menus that when the mouse is unlocked and useable. In this case I want certain elements to hide during mouselock/unlock states.

If I have two menus like this:
[menu1]

  • text
  • option1
  • option2
  • option3

[menu2]

  • text

Do I want to create a different actor for each? I’ve only seen that I can remove widgets from parents, or add them the ui, but is there a way to access and hide ‘option1’,‘option2’ & ‘option3’ without switching out out the entire actor or is the widget made to represent a single element and not a whole section of the interface?

Hi,

from what I read (and understand):

I would add methods to the UI which are showing / hiding parts of the UI.

If the user takes action then you can simply trigger this methods. If you organize the widgets onto panels you can simple made them invisible if you want to. So you don’t have to remove them from the itself (unless you have different UIs and want that behaviour)

Probably something like this would work:

BP_UI_Menu.ShowMenu(int index) (or text, or enum)
hideAll()

switch on index
   case 1: menu1.setVisibility(visible)
   case 2: ....

Few thoughts on this

Kind Regards

freakxnet

If you select the container, ([menu1]/[menu2] in this case), you can expose it as a variable at the very top of the widget Details panel. This will allow you to set the desired Visibility of this elelemnt, which will also affect its children.

And yeah, as freakxnet suggested, it’s usually much easier to hide/unhide rather than remove/create the widget. If your menu’s complexity gets out of hand, consider creating a *CustomEvent *in the widget with an enumerator input and a switch.