Problem resizing an array within a struct

I’m building a grid-based inventory system, and can’t seem to get this function to work. Basically, I created a 2D array by putting an array within a struct, then making an array of that struct. So we have the array ContainerInventory, which contains elements of the type struct Container Column, which in turn has an array of the inventory slots struct.

Whats happening is, when the container is initialized, I just want to resize ContainerInventory to match the pre-defined container width, then iterate through ContainerInventory and set all the empty arrays within ContainerColumn to match the pre-defined height. However, when it prints out the length of each Items array, it just says 0. Was wondering if someone could explain if I’m doing something wrong or being really dumb?

Quick edit to clarify a couple things, both the width and height are set to a value of 5. It appears to resize the ContainerInventory variable correctly, as it prints 5 of the message Column Size - 0.

you can’t directly set an “array inside a struct inside an array” when using blueprint. you can do it in c++ or you can make a temp array of structs that you use to create the outer array.

but if your goal is to make a grid of items, why not put them all in the same array? you could use modulus on the iterator to format a single array of objects into a 2D grid:

MenuPositionX + (SpriteSize + MarginSize) * (i % MenuWidth) , 
MenuPositionY + (SpriteSize + MarginSize) * FFloor( i / MenuWidth )  

that way you can separate content from presentation, allowing you to swap out the formatting style without duplicating the content. you can display the same list of objects as a circle menu, album flip book, scrolling list, skill tree, grid list, horizontal list, tabs, venn diagram, flow chart, etc… just by swapping out this logic.

Building a temp array is what I ended up going with.

I thought about doing it in one array, but certain inventory items will occupy more than one space, so my brain wanted to distill it into a form it understands, instead of having one object occupy indices 3,4,5,11,12,13, it just covers a space between 0, 3 and 1,5. Along with potentially having the container sizes vary and change. But maybe one array is still the best way to go and I just can’t quite figure it out.

Thanks for the answer.