why making 2d array in blueprint so difficult

I just want to create a simple 2d array of integer, but I found that it is very difficult in blueprint.
I have heard we can make a struct contains a array of integer, and then I can make a array of that struct so that I can have a “2d array”.
However, I also found that there is a bug that we cannot set element of array in struct.

Does anybody give me advice on how to make 2d array in blueprint? Or I can only use 1d array to implement the 2d array?
And why the bug haven’t fixed?

Thanks

Use a flattened Array instead

means:
Arr[y][x] would be Arr[y*x]

And to get an index use:
index = (y*x) + x

That way, the standard Arrays of Blueprints are enough to work with.

1 Like

The struct bug is getting fixed in 4.16 so you don’t have to wait too long.

No, an array in BP is a LinkedList, not an actual array we know from C for example.

But the flatting method is working :wink:

****ing finally.

Here you go https://youtu.be/4BI_CPYIRvs

I’m curious as to what Epic’s motivations behind this omission is…

And to get an index use:
index = (y*x) + x

I came across this old post, looking for a solution, and couldn’t get this calculation working, but it seems to work if you use:
index = (y position * number of rows in Y) + x position. So if we have a 4x4 grid, and we want to find the position at x=2, y=1, the index we want to look at is (1*4)+2.