Creating A UWidgetComponent at runtime in C++

Creating a WidgetComponent is no different than any other component. You can’t use CreateDefaultSubobject for runtime components since those aren’t defaults.

You would just use NewObject to construct the widget and attach it. There’s a more in-depth discussion of details here: Add component to actor in C++ (the final word!) - #8 by HappyHappyPlay