Unity Visual Scripting, Part 2
Data Types

In this article, we will discuss data types: nodes representing single pieces of information.
Data is the core of every script; in fact, all that computers do is manipulate and pass data.

There are many data types available for us to use in Unity Visual Scripting, but we don’t need to be familiar with all of them; The following are the most common ones:

Unity Visual Scripting – Numbers data types
Integer and Float literals.

Numbers

We have two types for representing numbers:
Integer is a data type of number values like 6, 10, and -9, commonly used for counting or ordering.
It can represent both positive and negative numbers, but not numbers with a fraction like 1.5 or 3.14.

To represent these numbers with a fraction, we have the Float data type like 0.5, 7.0, or -2.4; Primarily used for measuring. However, besides storing both positive and negative numbers, it’s not limited to fraction numbers only – it can also represent an integer-like value such as 4.0.

We mentioned we use number types for counting or measuring. In addition, we can also use them for arithmetic operations like addition and division or even comparing whether, for example, one number is greater than another.

Unity Visual Scripting – Boolean data type
Boolean literal.

Boolean

Boolean is a data type with only two possible values – either true or false. It can represent an object state, like whether a door is open or closed.
As we will later learn, we can leverage them to execute different sections of the Graph’s flow.

Unity Visual Scripting – String data type
String literal.

String

A String is a variable-length text, a sequence of characters like a name or a message. It can contain letters, numbers, symbols, and even emojis.
We can use it to print messages to the debug console or display dynamic text in the game’s UI.

Unity Visual Scripting – Enum data type
Enum literal.

Enum

Enum, short for Enumeration, is a data type consisting of a predefined set of values. For example, we can have a Platform enum made of PC, Mobile, PlayStation, and Xbox. We will usually use them to specify a single value from the available options it defines.

Unity Visual Scripting – Vector 3 data type
Vector 3 literal.

Vector

Vectors are a group of 2, 3, or 4, Float values. It can represent a character’s position, speed of a moving object, the distance between objects, and more.
Depending on the vector type, we can access its float components through the X, Y, Z, and W properties.
For example, a Vector 3 consists of three floats accessed through X, Y, and Z.

We frequently use the following assets and highly encourage you to check them out!

Ports

Nodes may have input and output ports; each excepts or provide a value of a specific data type. We can distinguish the port’s data type by its icon.

  • Primitive data types, like most of the types we discussed in this video, are represented with a circle – where each type is colored differently.
  • Object data types, which are data types composed of multiple data types, are represented with an illustrative icon. For instance, a Vector data type is displayed with colored arrows.

Literals

Besides nodes’ ports, we can add a data type value in our script using a Literal. In the Fuzzy Finder, we can search for the Literal term of each data type to add it to the script and then pass it as an input to another node.

Hey! Before you move on...

If you want to ask, comment or suggest — I would love to hear from you! for more, and be sure to subscribe to for the latest tutorials.