Download

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.

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…