Make C++ Widget accessible with UMG editor
How do you make an accessible widget for blueprint in C++ ?
Here I'me creating my widget like that :
I want the widget editable as the CanvasPanel in default UUserWidget with UMG editor (The UserWidget inherit from UPersoUserWidget) :
But I can't find where this canvas panel is declared. Maybe a UPROPERTY meta allow this use ?
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:
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:
for example this will create simple text widget:
You also need to synchronize Slate widget with your UMG properties in SynchronizeProperties() function
But if you want to make base for Widget Blueprints then you should use BindWidget specifier method insted.
answered Mar 18 '18 at 08:06 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here