You can use User Widget Scene Graph Entities to create UI elements that are reactive to in-game events.
User Widgets
Being able to read a User Widget helps you to understand the makeup of a UI. User Widgets exist for common UI elements such as health bars and score boards.
You cannot interact directly with in-world UI created with widgets, the UI elements created with widgets respond to in-game events, such as an increase in score or a loss in a player's health value.
User Widgets in Verse
Each User Widget is represented in Verse as a class. You can also find a Scene Graph entity corresponding to each existing User Widget. For example, UW_Scoreboard and UW_Scoreboard_entity. Using Scene Graph entities allows you to respond dynamically to in-game events. Like incrementing a score board upon hitting a target.
For more information on UMG widgets, see UMG Widgets.
For more information on widget types, see Widget Types.
Scene Graph Entities are not compatible with standard devices. To add device functionality, you must use Verse devices.
Adding a User Widget Entity Prefab to Your Level
There are multiple methods to add User Widget entities to your level. You can add an existing widget directly from the Content Browser, create a blank entity and add a User Widget entity to it, and attach a User Widget entity to an existing entity using Verse.
Adding an Existing User Widget Entity from the Content Browser
You can add User Widgets to your level by dragging them directly into the scene from the Content Browser. The process below details adding an existing User Widget to your level from the Content Browser:
Drag an existing User Widget Blueprint from the Content Browser into your level as if it was any other level asset.It will be added to the level as an entity.
Adding a User Widget Entity to a Blank Entity
You can add a User Widget entity to a new blank Entity Prefab. This provides a foundation for more complex behavior by adding more components to the blank entity. Follow the steps below to add a Blank Entity to your level and add a User Widget entity to it:
Add a blank entity using the toolbar: Place Actors > Entities > entity.
Right-click the blank entity in the Outliner and add a User Widget entity as a child. Such as the
UW_Rainbow_entity.
Adding An Existing User Widget Entity to another Entity Using Verse
You can add a User Widget entity to an existing entity using Verse, this allows UI elements to respond to in-game events, such as a defeated enemy or a button press.
Create an empty entity Prefab
Ensure that you have an existing User Widget for the empty entity prefab to target.
Add a new Verse component to it. For example,
inworld_ui_spawner_component.Drag the Prefab into your level.
Open
inworld_ui_spawner_component.Create Verse logic to spawn the entity, example below, note that this code relies on a Button device to trigger adding the widget to this Prefab.
Verseusing { /Verse.org } using { /Verse.org/Native } using { /Verse.org/SceneGraph } using { /Verse.org/Simulation } using { /Fortnite.com/Devices } using { /Verse.org/SpatialMath } inworld_ui_spawner_component<public> := class<final_super>(component): WidgetToSpawn : UW_MyWidget_entity = UW_MyWidget_entity{}Select your prefab, then inworld_ui_spawner_component, then pick this Button device under the Button editable field.
Launch your session. Interact with the Button device. The widget should spawn where the entity is.
Once you have placed your User Widget into the level, you can customize it further using the UI Widget Editor.
For more information about how to create custom UMG buttons, see Custom Buttons.
For more information about how to create custom layouts for your UI designs, see UI Layout in UMG.
Accessing Verse fields on the Widget
All functionality, like Verse fields and animations, is carried over from the regular screen-space widgets.
You can pass data between Verse fields and the widget as you would for a typical screen-space User Widget. For example:
@editable
ScoreboardWidget : UI.UW_Scoreboard_entity = UI.UW_Scoreboard_entity{}
OnBegin<override>()<suspends>:void=
set ScoreboardWidget.MyMessage = MyMessage
TargetDummy.KnockdownEvent.Subscribe(OnDummyKnockdown)
NOTE
You need to access the entity class of the widget, not the widget class to modify the behavior of the widget entity.
For more information about using Verse fields in a UMG User Widget, see Using Verse Fields in a UMG User Widget.
Troubleshooting User Widget Entities
Once you have finished designing your User Widget entity and have placed it into your level, you may find that you cannot see it. Double check these common issues to see if they apply:
The entity might be placed below ground. Check the transform coordinates of your entity and adjust accordingly.
The entity may be too small. This is common with widgets containing small amounts of text or a small image. The bounds of the widget conform strictly to the size of the content. Scale up the entity using the
transform_componentto approximately 10x scale to ensure you can see it clearly and then fine tune to your needs.The entity may be oriented incorrectly. Move around the level to check if the entity is facing the wrong direction.