banner
YZ

周周的Wiki

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

UMG Editor Workflow

Creating UI Controls#

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

  2. In the pop-up window, click on User Widget to create a UI control. You can customize the name (it is recommended to name it as WBP_XXX).
    Pasted image 20240822113459

Introduction to UMG UI Editor#

Double-click on the UI control blueprint to open the UMG Designer:
Pasted image 20240822114021
UMG consists of seven main parts:
Pasted image 20240822115221

TabPurpose
1. DesignerCanvas for designing UI layout, used to build and display UI, and position UI on the screen
2. PaletteList of available controls, including built-in and user-defined control templates
3. DetailsProperties of the control, including rotation and transformation properties
4. HierarchyDisplays a list of all created controls and their hierarchical relationships
5. AnimationsDisplays animations created for UI
6. TimelineProperties and keyframes of control animations, can be used to create frame animations
7. Editor ModeSwitch between Designer and Graph modes, Graph mode has almost the same functionality as Blueprint Editor
tip: On the canvas, you can pan the canvas by holding the right mouse button and moving the mouse, and zoom the canvas by scrolling the mouse wheel.

Building the UI Interface#

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

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

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

Displaying the UI Interface#

When you run the game and find that you can't see the UI you just designed, it's because you need to display the UI in the Game viewport and do some additional blueprint operations.

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

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

  3. Place the mouse over the execution pin of the Event BeginPlay node, hold down the left mouse button, drag it to a blank area, and release it. Then search for the Create Widget node and click on the Class parameter dropdown list to search for the UI instance we want to create, "WBP_HUD".
    Pasted image 20240822152638

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

  5. Click on the Compile and Save button in the upper left corner, close the window, and click on the Run button in the main editor interface. Now you should 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.