For the sake of future people with similar issues, I’ll list things that I’ve tried.
Adding UUserWidget directly to a ScrollBox**
This is the similar to my flow when using Widget Blueprints. I’m trying to add a button to the UUserWidget, then add the UUserWidget to a Panel (a ScrollBox, in this case).
Following this tutorial, I added the following code to my UUserWidget’s Init function:
Then, in my game manager class, I try to initialize an instance of my UUserWidget (ForestObject):
Note: TextUI is just a UUserWidget that I parent to the Widget Blueprint where I do my UMG designer stuff. It’s mostly a way for my UI to interact between C++ and blueprints.
This leads to a crash with the following first few lines of log:
Access violation - code c0000005 (first/second chance not available)
UE4Editor_UMG!UWidgetTree::ForWidgetAndChildren<<lambda_803f8c35be5f25e40019c9433cf4e614> >() [d:\build\++ue4+release-4.15+compile\sync\engine\source\runtime\umg\public\blueprint\widgettree.h:87]
Edit: Looking at this thread, it seems like I might not want to extend UUserWidget class at all, since I don’t want to manipulate these objects in the designer, only add them to a panel at runtime. Going to explore making a UWidget-derived class that acts as a wrapper for an SButton with text.