Drawing shapes with Widget Blueprints

The UMG Editor uses a specialized type of Blueprint called a Widget Blueprint. Since the First Person template has no UI elements by default, we should create a new folder to store our GUI work. Follow these steps to create a folder and a Widget Blueprint:

  1. Return to the FirstPersonExampleMap tab and navigate to the Content Browser panel.
  2. Open the FirstPersonBP folder, right-click in empty grid space next to the list of folders, and select the New Folder option. Let's keep things simple and call this folder UI.
  3. Open the UI folder you just made, and then right-click in empty folder space. Go to User Interface | Widget Blueprint and name the resulting Blueprint HUD.
  4. Double-click on this Blueprint to open the UMG Editor. We will use this tool to define how our UI is going to look on the screen.
  5. In the UMG Editor, find the panel labeled Palette. Inside it, open the category named Panel. You will see a series of containers listed that can organize the UI information.
  6. Select and drag Horizontal Box out of the Palette panel onto the Hierarchy panel, releasing it on top of the Canvas Panel object.
  1. You should now see a Horizontal Box object nested underneath the Canvas Panel object in Hierarchy. Our immediate goal is to create two labeled Player Stats Bars using a combination of vertical boxes, text, and progress bars. The final setup will look like this:

  1. Two vertical boxes will contain the text and progress bars of our Player Stats UI. Look again at the Panel category within the Palette panel, and then drag the Vertical Box object onto the Horizontal Box object you created in Hierarchy. Do this a second time so that the two vertical boxes are aligned underneath Horizontal Box.
  2. To keep things organized, let's apply labels to our objects. Click on Horizontal Box and look at the Details panel on the right side of the Editor. Change the top field, which shows the label of Horizontal Box, to Player Stats:

  1. Using the same method, change the labels of the two vertical boxes underneath Player Stats to Player Stats Text and Player Stats Bars.
  2. Now, look under the Common category of the Palette panel to find the textboxes and progress bars we need to create the UI. Drag two Text objects onto your Player Stats Text object, and two Progress Bar objects onto Player Stats Bars.

We already have the UI elements that will be used to display Player Stats in our HUD. The next step is to adjust their appearance and their positions on the screen.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset