How to construct a UButton in C++?

I think you’re running into the same issues I had. It’s been a while since I’ve tried this so I don’t remember the exact details. I think the widget tree is being reset in the editor. There should be a way to do it in C++. The engine is in C++ after all. But I was never able to get any further than this. I eventually created a Slot where I wanted my widget to be placed and I create the widget at runtime and dynamically added it to the slot.

Hopefully someone else can help getting you the rest of the way.

1 Like