Types
In modern scripting, everything is an Object: numbers, pieces of text, vectors and Unity components are all objects. To differentiate what they represent and what they can do, each object has a Type. In Bolt, most types are represented with an icon.
There are hundreds of types available in Unity and Bolt, but you don't need to know each of them by heart. However, you should be familiar with the most common types. Here's a little summary table:
Type | Description |
---|---|
Float | A number with or without decimal values, like 0.5 or 13.25. |
Integer | A number without any decimal value, like 3 or 200. |
Boolean | A value that can only be either true or false. Commonly used in logic or in toggles. |
String | A piece of text, like a name or a message. |
Char | ne single character in a string, often alphabetic or numeric. Rarely used. |
Enums | There are many enums. Each one is a finite enumeration of options that are often seen in dropdowns. For example, in Unity, the "Force Mode" enum can be either "Force", "Impulse", "Acceleration" or "Velocity Change". |
Vectors | Vectors represent a set of float coordinates, for example for positions or directions. There are 3 vectors in Unity: Vector 2, with X and Y coordinates for 2D; Vector 3, with X, Y and Z coordinates for 3D; Vector 4, with X, Y, Z and W coordinates, rarely used. |
GameObject | Gameobjects are the base entity in Unity scenes. Each game object has a name, a transform for its position and rotation, and a list of components. |
Lists | A list is an ordered collection of elements. The elements can be of any type, but most often, all elements of a list must be of the same type. You can retrieve and assign each element in a list by its zero-based index (position). |
Dictionaries | A dictionary is a collection in which element has a unique key that maps to its value. For example, you could have a dictionary of age (integer values) by name (string key). You can retrieve and assign each element by its key. |
Object | "Object" is a special type. Like we said, every other type is also an object. But when you see, for example, that a node asks for an object, it usually means that it doesn't care about the type of that object. |
When you need to select a type, Bolt will display a menu like this one:
As you can see, the most common types are available at the top. Enums are grouped at the bottom. All other types are grouped in their Namespace, which is nothing more than a "folder" for types. All Unity components and types are found under the Unity Engine namespace.