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

4 - Performing a Union of Blueprint Sets

Choose your OS:

In this step, the final one of this tutorial, you'll learn how to perform a Union of two Blueprint Sets, ultimately printing the result of the Union in the game's Viewport.

  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. At this point in the tutorial, you'll want to create a new Blueprint Set container for the upcoming Union. Go ahead and right-click on the Shorter Instruction Set Variable and select Duplicate from the drop-down list to create a new Blueprint Set variable, naming it Longer Instruction Set.

    Step4_2.png

  3. Now, go ahead and click the Compile button.

    Click for full image.

  4. Click the Removes all items button to clear all of the items from the Longer Instruction Set.

    Click for full image.

  5. Add the following items to your new Longer Instruction Set container:

    Step4_5.png

  6. Drag the Longer Instruction Set and the Instruction Set variables into the Blueprint Graph.

    Click for full image.

Scripting the Logic

  1. To get started with building your new logic, drag off the Longer Instruction Set and add the Union node from the Set Utilities interface.

    Click for full image.

  2. Connect the Instruction Set node to the Union node.

    Click for full image.

  3. Connect the Cast Failed pin of the Cast To FirstPersonProjectile node to the Union node.

    Click for full image.

  4. Now, drag off the Union node, search for, and add the To Array node.

    Click for full image.

  5. Drag off the To Array node, search for, and add the ForEachLoop node.

    Click for full image.

  6. Connect the To Array node to the ForEachLoop node.

    Click for full image.

  7. Now, you're ready to print the union's results to the Viewport. To do this, drag off the Array Element pin of the ForEachLoop node, search for, and add the Print String node.

    Click for full image.

  8. Connect the ForEachLoop node to the Print String node.

    Click for full image.

  9. Because you already have a debug message being printed, you'll want to change the color of the text being printed to the Viewport. To do this, go ahead and click the menu expansion arrow, which is located at the bottom of the Print String node.

    Click for full image.

  10. Click on the Text Color box to open the Color Picker menu.

    Click for full image.

  11. Go ahead and set the color to the following values:

    Step4_17.png

  12. Now, go ahead and click the Compile button.

    Click for full image.

  13. After expecting your completed script, go ahead and click the Save button before returning to the Editor's Viewport interface.

    Click for full image.

  14. From the Editor's Viewport interface, click the Play button to see the updated script at work.

    Click for full image.

End Result

As you can see from the video, when the First Person Character collides with the Display Set collision box, the result of the Union is printed to the Viewport. Again, looking at the printed items, you'll notice that the items are not in any predictable order, which is a property of Blueprint Sets. As a final reminder, if you performed a Union operation of both Blueprint Sets on paper, you would have come up with the following result:

Instruction Set

Longer Instruction Set

Resultant Output (A ∪ B)

Click

your

Click

the

Gun

the

Left

Left

Mouse

Mouse

Button

Button

and

and

Fire

Fire

your

Gun

Tags