I have an actor that uses UUserWidget. I need to add a widget from the editor to this actor.
What I have in the code:
However I cannot manage to add anything to this field in the editor. It seemed to me like this field should accept User Widgets, but it doesn’t. What do I have create/cast to work with UUserWidget?
You cannot add directly an user widget. You need to use a UWidgetComponent that will hold the actual widget.
UWidgetComponent is marked as experimental
I have that already working with SOverlay, I just don’t know how to connect a widget in the editor to the field I created with UUserWidget*
When you add a UWidgetComponent variable to your class, you should be able to see the user interface config values
Set the Widget Class to your UUserWidget.
In order to see the UWidgetComponent in the editor, make you have access to it:
Add a UWidgetComponent* not a UUserWidget*
Don’t forget to create the component and add attach it to your actor
Thank you! I will only be able to try this on Monday, I’ll get back here then.
EDIT: It worked, thank you!