How to make an array of arrays?

Hey testing around with variables and I couldn’t figure out how to make an array of arrays.
For example:

let arr =
[0,0],
​​​​​​ ​[0,0]
];

I would need this to make a grid with a X&Y coordinates

You don’t. It’s not supported in blueprints. The workaround is to create a blueprint struct that contains an array property and make an array of those structs.

5 Likes

Create a struct class containing an array of the desired type. Create a variable as this struct type, and make it an array of structs. Now you have an array of arrays.

6 Likes

Or use a flattened Array for 2D Coordinates…
Means


arr y , x ] 

will be


arr y * x ]

Setting something into Coordinate:


arr ( y * x_width ) + x ] = var

Getting something from Coordinate:


var = arr  ( y * x_width ) + x ]

Therefore, create Macros/Functions for Get/Set.

For this example you can add int point variables to the grid array, which individually save “x , y” values