Room Grid is a struct that contains a struct array named XDim, which in turn contains a struct array named YDim, which in turn contains a struct array named ZDim, which holds enums that represent game tiles. My attempt at creating a 3d array.
When the above script executes, only the XDim array gets resized. Why?
Also, what is the best way to create multidimensional arrays? Googling reveals a number of different ways. Is there a generally accepted “best way” to do this via blueprints? Some of the examples I found are over a year old and may be depreciated by new engine features.
I think that the best approach would be by simply creating a new object with 3 arrays as properties.
for the resize part, you should consider the fact that in computer science the usual approach to resize an array is simply eliminate that array, create a new one and copy the older elements in the new one.
I do not know how it is actually implemented in this case but there is a 99% that it is the same here.
I would avoid resize as much as possible
I would say the reason only XDim is resizing is because it is the only one tied to a variable. You are trying to resize the broken sub-arrays without actually setting anything. Break the sub-array out, set it in a variable, resize that variable, and then use the variable in the next step, and at the end plug the sub-array back into the main array so that your top most variable has the latest info.
don’t know the answer, but there seems to be another issue with your code: the second foreachloop happens after the first one completed. meaning it’s only ran once, but you’d need to run it for each of the ydim-arrays. (i.e. remove connection from completed to exec, make connection from resize to exec)