1.6 - Simple Math

This example demonstrates how simple math equations can be performed on data within Blueprints. In this case, we add up the amount of time the game has run and apply the number of seconds to a Text Render Component.

Components

The Components for this example consist of two Text Render Components. One simply displays the number of seconds that have passed, the other provides a label for that text.

1.6Components.png

Construction Script

The Construction Script for this example simply sets the text of the Text Render Component to the value of IntegerVariable (private variable). This data is cast to a string in order to be compatible with the Text property of the Text Render Component.

1.6ConstructionScript.png

EventGraph

The event graph for this Blueprint handles the work of mathematical addition.

1.6EventGraph.png

  • On every tick (Event Tick):

    1. A 1-second delay starts.

    2. At the end of the delay, we add 1 to the current value of IntegerVariable and set the sum as the new value of IntegerVariable.

    3. Sets the text of the TextRenderComponent to the value of the IntegerVariable. This value gets cast to a string.