Announcement

Collapse
No announcement yet.

Dynamically create UMG widgets (subclass of UUserWidget) in C++?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Dynamically create UMG widgets (subclass of UUserWidget) in C++?

    Hey guys,

    I'm trying to create my subclass of UUserWidget (UTargetInfoWidget) in C++.

    How should I go about this? SNew doesn't seem to like widgets, and you can't instantiate UObjects without some sort of constructing object (UWorld, GEngine, etc). Additionally, SNew suggests that the return be stored in a TSharedPtr or TSharedRef, which you can't use for UObjects.

    Any ideas?

    Thanks.

    #2
    In 4.5 there are some CreateWidget<T> global functions you can use. For 4.4, probably best to use the same one Blueprints use, UWidgetBlueprintLibrary::Create. SNew is for Slate widgets, you wont use it at all in UMG unless you're implementing a new primitive (non-uuserwidget) widget, that wraps an existing Slate widget.

    As for extending UUserWidget in C++, you're in luck there's a good tutorial here, https://forums.unrealengine.com/show...Widget-for-UMG

    Comment

    Working...
    X