The easiest way to do this is to create a base menu widget, add scroll boxes for the layout you want, and have a separate class to handle the actual display (ie the 3x3x4 Puzzles [Solved 7/50]).
What you do at runtime is construct however many of that separate class you want, give them the data they need or at least a way to get that data, and populate your scroll boxes with those constructed widgets (you do this by adding the widget as a child to the scroll box- make sure the scroll boxes have “Is a variable” checked).
I assume this means I need to create a C++ class which extends Button.
Next, I have a class that extends UGameInstanceSubsystem so I can override the Initialize function. That is where I will create all the instances and populate the menu.
Not necessarily. I’d highly recommend avoiding C++ when it comes to UI.
UI is extremely visual- having to recompile every time you want to make a slight change is bound to be a pain.
I recommend just creating a new widget that HAS a button, rather than is one.
Extending from button isn’t supported in blueprint.
I’d suggest the menu populates itself- no need to get external objects involved. You’ll want to create the puzzles outside the UI, but the UI itself should be made by the UI.
To get a visual representation in the editor, you can use the pre-construct event to create the UI using placeholder data.
I created a Widget called MainMenuButton which has a Canvas Panel, then a button, and then a text box. I checked the Is Variable box on the button and the text.
Next, I created a Scroll Box widget called MainMenuScrollBox and check the Is Variable checkbox.
Now, when I go to the Blueprint for my Main Menu, I can create the MainMenuButton instance, but I don’t see a way to add them to the scroll box. I found founctions to add a child to a vertical box or horizontal box, but nothing to add it directly. I added a Vertical Box inside the scroll box and I can add the buttons to it using this: