Choose your operating system:
Windows
macOS
Linux
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.
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.
EventGraph
The event graph for this Blueprint handles the work of mathematical addition.
-
On every tick ( Event Tick ):
-
A 1-second delay starts.
-
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.
-
Sets the text of the TextRenderComponent to the value of the IntegerVariable. This value gets cast to a string.
-