UMG integration

Gameface is also integrated into Unreal Motion Graphics using the provided UCohtmlWidget, which can be found under Gameface category in the UMG Editor. It automatically spawns and owns a SCohtmlWidget, where Gameface will render a cohtml::View.

An example usage of the UMG Widget can be seen in the provided UMGMap, found in CoherentSample/Content/Maps/SampleMaps. The map uses the UMGHUD Widget Blueprint, found in CoherentSample/Content, which contains a single UCohtmlWidget stretched across the screen.

The Widget has exactly the same API like the Components (ACohtmlComponent / ACohtmlHUD). You can use the UMG Widget wherever you are using the Actor Components if you prefer to do so.

Widget update flow

The UCohtmlWidget has a pseudo-Tick method for calling cohtml::View::Advance of the cohtml::View, which is invoked by a FCohtmlWidgetTickFunction, that inherits from FTickFunction. This way, even though the owned SCohtmlWidget’s Tick happens near the end of the frame (since that’s when the SlateApp’s Widget objects are updated), its owner (the UCohtmlWidget) will have been already updated during the same frame (triggering a cohtml::View::Advance call). This allows enough time for the UI Layout to have been calculated by the time the cohtml::View::Paint call happens on the Rendering Thread, avoiding any potential stalls.

Using UMG Widgets on in-game objects

You can use Gameface’s UMG Widget (UCohtmlWidget) within UMG Widgets attached as Components on objects in the game world. To get optimal visual quality in this case it is required to:

  1. Go to the Rendering properties of the Widget and set Blend Mode to Transparent.
  2. Uncheck the Gamma Corrected Material property of the UCohtmlWidget