Arrays in Blueprints: what they are and how to create one
An array is a collection of variables of one single type stored in one unit. To create one, make a variable, click the icon next to its type in the Details panel and choose Array. Each value has an index, and indexes always start at zero.
From the course
Taken from the hands-on project of the course; the lessons show every step on video.
What is an array?
A collection of variables stored in a single unit. It looks like a structured variable, but an array can only hold information of one type: an array of floats only stores floats. Picture a box that accepts only whole numbers (an array of integers) and another that accepts only names.
How do I turn a variable into an array?
- Create the variable, name it and choose its type, for example Name.
- In the Details panel click the icon next to the variable type and select Array. The icon changes to a small 3 by 3 grid.
- Compile. The default value now lets you add several elements.
How do I recognize an array in the graph?
The data pin is not a circle but a small grid. The color follows the same pattern as variables: red for Boolean, green for float, yellow for vector. When the pin is disconnected the center of the grid is empty, and when you connect another node, such as a Get, the center fills in.
What are indexes?
In the lesson the Names array has John, Paul, George and Ringo. Each value corresponds to a number on its left: 0, 1, 2 and 3. These numbers are indexes, and they start at zero. The value at index 1 is Paul and at index 2 is George. Click the arrow next to a value to delete or duplicate it.
Where will I use arrays?
Anywhere you keep a list: names, positions, objects in a scene. The next guides show the nodes to read, search, add and remove values.
Free PDFs that go with this page
One-page guides made from the lessons, sent by e-mail.
- Arrays in Blueprints — Every array node you need, what it does and what it returns, from the lessons of the course.
- Variables and data types — What each Blueprint variable stores, plus the Get, Set and struct moves that go with them.
- Free PDFs
Frequently asked questions
What is an array in Unreal Engine Blueprints?
A collection of values of the same type stored in one variable.
Where does an array index start?
At zero: the first element is index 0.
Can an array hold different types?
No. An array holds only one type, such as only floats or only names.