How do you make an accessible widget for blueprint in C++ ?
Here I’m creating my widget like that :
#PersoUserWidget.h
// The widget I want to be able to edit in the UMG editor.
// Maybe a meta ?
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Widgets")
class UMyWidget * TheWidget;
You implmenting widget in wrong way. In order to understand whats doing on here you need to understand difference between UMG and Slate. Slate is UI framework build originally for editor, but can be used in game, but because all classes of Slate operate outside of UE4 reflection system so Slate can’t be used in blueprints. Thats why UMG was made, UMG is Slate wrapper for blueprint, yes UMG is not really UI framework on its own, just way to make Slate usable in blueprints with some extra features like animations and layout editor which Slate alone don’t have.
UWidget is Slate widget wrapper class, in RebuildWidget UMG expect you do define Slate widget (SWidget) and this is what you should do in RebuildWidget.
If you want to make widget that contains UMG widget, then you make UUserWidget with widget properties with this specifier:
UPROPERTY(meta = (BindWidget))
someone explained this well here:
If you ask me Slate is a lot easier to operate in C++ then using only UMG, so i think best option to do C++ widgets is to make UWidget (not UUserWidget as this class is made to contain other UMG widget, but if you use Slate you don’t use any other UMG widgets) and define slate widgets in RebuidWidget. You can read about slate here: