← Learn library

Unreal Engine & Blueprints / Unreal Engine

Unreal Engine 4 Blueprint Scripting Basics Math Operations

Channel: CGI Nerd ·

Legacy TutorialWritten guide

This tutorial is part of the CGI Nerd archive. Some software features, interfaces, or workflows may have changed since it was recorded.

Original CGI Nerd video thumbnail
Unreal Engine 4 Blueprint Scripting Basics Math OperationsCGI Nerd · Video hosted on YouTube

Playing loads YouTube content. YouTube processes data after activation.

Watch on YouTube

If the player is blocked or unavailable, use Watch on YouTube.

Software: Unreal Engine

Read Blueprint variables, perform arithmetic and display the result, then turn the same pattern into a click counter. The lesson progresses from two integers to components inside a vector and transform, showing how to reach the numeric value an operation actually needs.

The title identifies Unreal Engine 4; the exact minor version is unverified. Addition is the operation demonstrated in depth. Subtraction, multiplication and division are mentioned as available operations, but the recording does not separately explore their edge cases.

Add two integer defaults and observe the result

At 00:01, create an Actor Blueprint and use Begin Play for the initial tests. At 01:03, add an integer variable, compile and set its default to 45. Create a second integer with default 50.

Drag Get nodes for those variables into the graph. A Get supplies the current value; it does not assign a new value. At 03:01, find Integer + Integer through the context menu or a text search.

Connect the sum to Print String through the conversion node and connect Begin Play to the print’s execution input. The source first tests the addition node’s literal inputs, then connects the variables. At 05:00, the placed Actor prints 95, confirming 45 + 50.

If the on-screen message disappears too quickly, inspect the Output Log. Also inspect the addition inputs: leaving the initial literal values in place tests those constants, not the variables you intended to use.

Break a vector only when you need its components

At 06:01, create a Vector with components 100, 2 and 5. Converting the whole vector to a string prints all three values. That is useful for inspection, but it does not select one component for arithmetic.

At 07:02, use Break Vector to expose X, Y and Z separately. At 08:00, printing only X gives 100. The output is now a scalar component rather than the complete vector.

At 09:00, use Float + Float and add another input pin so all three components participate. The resulting 107 is a sum of components. It is not the vector’s length or a new position vector; those would require different operations.

This distinction prevents a common conceptual error: extracting numeric fields and adding them is meaningful only when that sum matches the question being asked.

Break the transform, then break its location vector

At 10:02, create a Transform variable. At 11:00, Break Transform exposes Location, Rotation and Scale. Break the Location vector again to reach its scalar components.

The source enters location values 12, 16 and 81, then adds them to produce 109 around 12:00. The narration briefly revises the last entry from 18 to 81; the demonstrated total supports the latter.

A transform is not simply three interchangeable vectors. Epic’s Blueprint variable reference describes Transform as translation, rotation and scale; Rotation is exposed as a Rotator. The recording’s informal “three vectors” description should not erase those different roles.

Breaking the value provides access to its fields. It does not move an Actor unless those values are subsequently used in an operation that assigns a transform to a scene object. This exercise only calculates and prints the location-component sum.

Store the increment so the next click sees a new value

At 12:00, replace Begin Play with Left Mouse Button Pressed. Reset the first integer’s default to 0 and add a Set node followed by Print String.

At 14:03, get the integer’s current value, add 1 and feed that result into Set. Connect the press execution to Set and then Print. The assignment is essential: printing current value + 1 without storing it would repeatedly calculate from the unchanged value.

At 15:01, set Auto Receive Input to Player 0 in the Actor’s class defaults. Compile and play with the Actor placed in the level. Each click increases the stored value by one and prints the new count.

Check the sequence as read → add → set → print. If it always prints the same number, inspect the Set value and execution connection. If it never responds, inspect the Actor instance and input setting. The source demonstrates a local interactive counter; persistence between play sessions, overflow behavior and multiplayer synchronization are outside its scope.