banner
YZ

周周的Wiki

种一棵树最好的时间是十年前,其次是现在。
zhihu
github
csdn

UMG Editor Workflow

Creating UI Widgets#

  1. In the Content Browser panel, click Add or right-click in a blank area, then select User Interface / Widget Blueprint in sequence.
    Pasted image 20240822112655

  2. In the pop-up window, click User Widget to create a UI widget, and you can customize the name (a more standardized name could be WBP_XXX).
    Pasted image 20240822113459

Introduction to UMG UI Editor#

Double-click the UI Widget Blueprint to open the UMG Designer:
Pasted image 20240822114021
UMG consists of seven parts:
Pasted image 20240822115221

TabPurpose
1. DesignerThe canvas for designing UI layouts, used to build and display UI, allowing placement of UI on the screen.
2. PaletteA list of available widgets, including engine-provided or user-defined widget templates.
3. Details PanelProperties of the widget, including rotation transform properties, etc.
4. Hierarchy PanelDisplays a list of all widgets currently created, showing the hierarchical relationship between UIs.
5. Animations PanelDisplays all animations created for the UI.
6. TimelineProperties and keyframes of widget animations, allowing for frame animations.
7. Editor ModeSwitch between Designer and Graph editing modes; the Graph mode has almost the same functionality as the Blueprint editor.
tip: To operate on the canvas, hold the right mouse button and move the mouse to pan the canvas up, down, left, or right; use the mouse wheel to zoom the canvas.

Building the UI Interface#

Before designing the UI, you should first place a Canvas Panel in the canvas as the root object.
You can search for Canvas Panel in the Palette or find it under the Expanded Panel: click and hold the left mouse button to drag it into the canvas area or release it in the Hierarchy Panel.
Pasted image 20240822141729

After that, you can place other widgets you need in the canvas, such as text, buttons, etc.
Pasted image 20240822143147
You can also rename widgets, drag them, resize them, and modify related information through the Details Panel.

After designing the UI interface, remember to click Compile and Save in the upper left corner of the editor.

Displaying the UI Interface#

When you happily run the game but find that you cannot see the UI you just designed, this is because you need to perform some additional Blueprint operations to display the UI in the Game viewport.

  1. In the main toolbar of the Level Editor, click Blueprint / Open Level Blueprint in sequence.
    Pasted image 20240822151538

  2. Right-click in a blank area to search and add the Event BeginPlay node.
    Pasted image 20240822151910

  3. Hover over the execution pin of the Event BeginPlay node, hold the left mouse button, and drag it to the remaining blank area, then search for the Create Widget node. Click the Class parameter dropdown list and search for the UI instance we want to create, “WBP_HUD”.
    Pasted image 20240822152638

  4. Similarly, connect the execution pin of the Create Widget node to the Add to Viewport node, and connect its return value Return Value to Target.
    Pasted image 20240822153013

  5. Click Compile and Save in the upper left corner, close the window, and click the Run button in the main editing interface. You should now be able to see the UI interface you created in the game viewport.
    Pasted image 20240822153431

Updating the UI Interface#

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.