This may be an excessively silly question, but my game has a large number of menus, and I’m slightly unclear: if the player is going to be opening and closing them a lot, is the recommended convention to create every menu at runtime and toggle visibility, or to actually create a new widget every time the menu is opened, and destroy it with remove from parent when closing it?
I’m currently learning the UMG and was wondering about the same thing. I ended up creating all widgets at menu “level” initialization and toggling visibility when leaving/entering widget. I’m going to destroy every widget when I go to game level where they are not needed and recreate them when player comes back to menu. Not sure if this is the best approach and would also like to hear other approaches and opinions.
I’m pretty sure that’s the better solution, I’m just iffy because memory is precious, and if a menu will only be open, say, 25% of the time you’re playing, I don’t know how to compare the memory you free up the other 75% of the time versus the cost of GC-ing away deparented widgets.