Skip to content

UMG Viewmodels

Viewmodels are a new way to bind Widget Elements to the backend data. They are event-driven, meaning that updates are only processed when data actually changes. You can read more about their operation in the official page.

Combat Vitals

The Combat Vitals Viewmodel provides access to all Combat Attributes related to player vitals: Health, Stamina and Magic. It provides their current value, maximum value and percents in the [0, 1] range, useful for Progress Bars.


You can add this Viewmodel as usual and decide if you prefer it to be initialized when the Widget Instance is created or manually at some other moment. Both options will be fine, however, it's important that whenever your Viewmodel is initialized, the proper Bind To Ability System function is called.

Initializing the Vitals Viewmodel

In the sample above, the initialization is set to "Create Instance", so the Viewmodel is created between Pre Construct and Construct. In this case, it's safe to initialize it during the Widget's Construct function.

Of course you can call this method anywhere else if you prefer to manually initialize your Viewmodel. Once again, make sure to familiarize yourself with this functionality and their initialization settings in the official documentation!


Once the Viewmodel has been initialized, we should take care of its bindings. Like mentioned before, the Vitals Viewmodel is designed to support damage numbers and progress bars. In the following image there are a few interesting things to notice.

Binding the Vitals Viewmodel

  1. For progress bars, we can bind their "Progress Value" to the "Percent" properties from the Viewmodel.
  2. For texts, we can convert the values using a "Conversion Function", in this case "Utilities/To Text (Float).
  3. You can decide how to convert and roud float values to their textual representations.