Create a custom SWidget/UWidget

The recipes in this chapter so far have shown you how to create UIs using the existing primitive widgets.

Sometimes, it is convenient for developers to use composition to collect a number of UI elements together, for example, to define a button class that automatically has a TextBlock as a label rather than manually specifying the hierarchy every time they are declared.

Furthermore, if you are manually specifying the hierarchy in C++, rather than declaring a compound object consisting of subwidgets, you won't be able to instantiate those widgets as a group using UMG.

Getting ready

This recipe shows you how to create a compound SWidget that contains a group of widgets and exposes new properties to control elements of ...

Get Unreal Engine 4 Scripting with C++ Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.