Language:
Page Info
Tags:
Skill Level:
Engine Version:

2 - Creating and Displaying a Blueprint Set

Choose your OS:

Now that you've set up a TextRender actor in your newly created project, you're ready to create a Blueprint Set container, the contents of which you'll display in-game.

  1. From your project's Content Browser, double-click the Display Set TextRender Actor to open its Blueprint Event Graph.

    Click for full image.

  2. If you see the following screen, go ahead and click the Open Full Blueprint Editor link to get started.

    Click for full image.

  3. You should see the Display Set TextRender Actor Blueprint Event Graph, where you'll be able to add a Blueprint Set and its diplay logic.

    Click for full image.

    If you don't see the aforementioned screen, go ahead and click the Event Graph tab to open the Actor's Blueprint Event Graph Editor.

    Click for full image.

  4. Now is the time to create a Blueprint Set container, where you'll store some items that you'll display later on. To create a new Blueprint Set, click the + Add New button (located in the My Blueprint panel) and select Variable from the drop-down list.

    Click for full image.

  5. Name your new variable, Instruction Set.

    Click for full image.

  6. Click the variable's pin type button, which is located next to the variable's name.

    Click for full image.

  7. Now, select the String variable type from the drop-down list.

    Click for full image.

  8. Click the variable's container type button, which is located next to the Variable Type drop-down list in the Details panel.

    Click for full image.

  9. Now, select the Set container type from the drop-down list.

    Click for full image.

  10. At this point, the Blueprint Graph reminds you that you need to compile the Blueprint in order to define the items that you're going to store inside of the container. Go ahead and click the Compile button to get started.

    Click for full image.

    Compiling the Blueprint replaces the container's Default Value message with an interface, enabling you to populate your container with unique items (or elements) of String type.

  11. If you already haven't done so, go ahead and click the Save button to save all of the work that you've done so far.

    Click for full image.

    In general, it's always a good practice to save early, and save often.

  12. Click the + (Adds Element) button (located in the Default Value menu of the Details panel) to add a String type item to your newly defined Instruction Set container.

    Click for full image.

  13. Define your container's new item, defining the item as Click.

    Step2_13.png

  14. Repeat the previous two steps, making sure to fill your Instruction Set container with the following items:

    Step2_14.png

Scripting the Logic

Before you can display the contents of your newly created Blueprint Set, you'll need to write the necessary logic.

  1. Now that you've defined your container, go ahead and drag the Instruction Set variable into the Blueprint Event Graph.

    Click for full image.

  2. Select Get from the Instruction Set drown-down list.

    Click for full image.

  3. Drag off the Instruction Set node and add the To Array node from the Set Utilities interface.

    Click for full image.

  4. Go ahead and drag off the To Array node, connecting it to a Get node.

    Click for full image.

    There are several ways to get items from a Set. One way is to query the Set with a specific key and another way is to iterate through the items in a set. For this part in the tutorial, we'll go ahead and use a counter variable to iterate our way through the Instruction Set.

  5. With the aforementioned note in mind, go ahead and click the + Add New button, selecting Variable from the drop-down list.

    Click for full image.

  6. Make sure to set the new variable's type to an Integer type, giving it the name, Counter.

    Click for full image.

  7. After you've declared and defined your counter variable, drag Counter into the Blueprint Event Graph, and select Get from the drop-down list.

    Click for full image.

  8. Drag off the Counter node, search for, and add the IncrementInt node.

    Click for full image.

  9. Now, go ahead and connect the IncrementInt node to the Get node.

    Click for full image.

    For the purposes of this tutorial, you're going to use a timer function to increment the Counter variable.

  10. Drag off the Event Tick node, search for, and add the Delay node.

    Click for full image.

  11. After you've set the delay duration to 2 seconds, connect the Delay node to the IncrementInt node.

    Click for full image.

  12. Go ahead and connect the Event BeginPlay node to the To Array node.

    Click for full image.

  13. At this point, you're ready to drag off the To Array node to search for, and connect the Set Text node in order to display your container's contents in-game.

    Click for full image.

  14. Connect the Get node to the Value pin (located in the Set Text node).

    Click for full image.

  15. Now, go ahead and connect the Increment node to the Set Text node.

    Click for full image.

  16. After inspecting your completed script, go ahead and click the Compile button before going back to the Editor's Viewport interface.

    Click for full image.

  17. From the Editor's Viewport interface, click the Play button to see your newly implemented script at work.

    Click for full image.

End Result

At this point in the guide, you've defined a new Blueprint Set, filled the container with items, and displayed them with some basic logic that you created in your TextRender Actor's Blueprint Event Graph. If you want to learn how to perform a slightly more advanced operation, please continue onto the next step, where you'll learn how to perform an Intersection of two Blueprint Sets.

Tags