There are many widgets in my project.Is there a better way to manage the switching and display of these pages?
Event dispatcher in easily accessible blueprint, like game mode or player controller.
All widgets hook to that dispatcher. And it will transmit data to them.
For data you should do:
- enumerator, telling widgets what kind of information you want to send, so they can decide if they are interested what is there or not.
- data field that should be just string, you can change all simple types of data into string and back
- and some additional stuff, like collapse/show certain groups of widgets, state (mode, displayed page) of gui etc.
Also you can create custom widgets then use them in cretaing “top” level ui.
So for eg. you can create page full of simple text widgets, save it as MyCoolWidget, then use it as single element/widget elsewhere. And put whole display/hide and hook to dispatcher logic in that gui container.