Adding and Creating UMG User Widgets
Now that we have created the Coin Collection UI in UMG, it is time to learn how to add and remove the UI to and from the player screen. By adding the Coin Collection UI to the player screen, the UI becomes visible to the player and can be updated as the player collects coins.
In Blueprints, there is a function called Create Widget
, as shown in the following screenshot. Without a class assigned, it will be labeled Construct None
, but do not let this confuse you:
This function requires the class of the User
widget to be created and requires a Player Controller
that will be referenced as the owning player of this UI. This function then returns the spawned user widget as its Return Value
, where you can then add to the player's viewport using the Add to Viewport
function. The Create Widget
function only instantiates the widget object; it does...