After creating my C++ class that extends the UUserWidget, I can see the custom widget properties in the Graph Edit -> Class Defaults. But when I try to add the widget to another widget it doesn’t render. Am I missing something?
I have the constructor, and Construct_Implementation:
If you’re trying to make a new kind of slate widget, make a Slate widget, and just wrap it with a UWidget. UuserWidgets are only intended for users making a user control in the designer, inheriting from it is mostly only supposed to be if you need to provide some native code behind for your specific user widget you plan to make in the designer.
Actually, yes, I am trying to make a widget that can be used in the designer similar to the Common controls: Button, Check Box, Image, etc.
When I create a class based on UUserWidget it shows up in the designer but doesn’t render. However, I haven’t found how to get a slate based class to show up in the designer.
EDIT:
I can edit slate derived objects in the Generic Asset Editor.
Any class derived from UWidget (but not UUserWidget) will show up in the designer. As Nick says, you should make your widget implementation in Slate (usually derived from SLeafWidget) and then create a UMG UWidget wrapper around it.
Just look at the existing widgets in the engine source code. SImage/UImage is a pretty simple example, I used it as a reference when I started making custom widgets.
I’m sorry. . .I haven’t connected the dots yet. In HelloSlate the HUD instantiates the SCompoundWidget. The same is true in SlateTutorials but the two tutorials use slightly different methods: SNew as apposed to SAssignNew. I suspect they are similar in functionality though.
Regardless though, my SCompoundWidget derived class isn’t viewable in the UMG designer. What do I need to connect to it in the designer?
Once you’ve made a Slate widget you need to wrap it with a UWidget. Slate isn’t UObject based, so it needs to be wrapped by one to be accessible to blueprints…etc. For examples, see any of the numerous controls in the UMG module, UImage, UButton…etc. Then it will show in the palette.
I created a C++ class based of Visual : Widget : PanelWidget : ContentWidget : Button in the Add C++ Class dialog box. Unfortunately UContentWidget isn’t recognized, and oddly enough Visual Studio cannot open the ButtonWidgetStyle.h header file.
Do I need to set an include path? That doesn’t seem right.
Okay, what I was trying to do may be easier than I thought. Basically after inheriting from UButton I am able to add additional properties and see the derived control in the UMG Palette:
Now I just have to work out the additional functionality