Two dimensional array
I would like to know if there's any two dimensional array in Blueprint scripting. I looked all over the official documentation and I only found that Array is one dimension only.
Thanks in advance !
asked Mar 01 '15 at 09:26 PM in Blueprint Scripting
Just as small heads up.
You can use an array of structs containing another array of another variable.
So two dimensional is very much possible. I'm not quite sure how it handles more dimensions than that though as I've never tested it but I can't imagine that it'd just break.
answered Mar 02 '15 at 12:21 AM
i think he got result already, but for people who may find this, solution is really simple:
filling such 2D array
get 2D array elements like [index1][index2] and printing values
see how printing look in game
what i didn't try:
set value in 2d array at already exist index (actually we didn't need it for our purpose, because generation of heigh map doesn't require changing after first fill), but i will try use "set array item" to see is i can set value of already exist 2d array element like [row1][column2]
UE4 reflection system does not support array in array (even in C++, regardless of fact that C++ allows to do so), so it's impossible to make multi dimensional array. But there very simple workarounds which makes single dimension array to work like two dimensional array, by playing allocation numbers. If one dimension has static size, you can multiply that size in allocator by number of y postions, like this:
Ofcorse you need to watch out to x not being higher or same then x_size or else it will read or set other y row. You can make functions to make it a lot cleaner and simpler
Follow this question
Once you sign in you will be able to subscribe for any updates here