How to loop arrays in blueprint

Hello, I’m trying to find a way to loop an array of X number of elements and have that repeat for a Y number of times.

In my project I’m trying to generate structures based on a template of meshes in an array. If the array has 5 static meshes in it and is set to be 5 segments wide it works perfectly (as this is the test number of meshes in the array). However when the number of segments is more than the number of meshes in the array it dosent generate. How would I loop the array so when it goes above the number of elements in the array it resets to 0 and starts the pattern again?

Thanks in advance.

Nested loop looks like this:

216070-loop.png

The bottom node can be quite useful, too if you want to generate an X, Y grid.

I did not really get this, though:

However when the number of segments is
more than the number of meshes in the
array it dosent generate.

Hello, thanks for the help, what I mean is, as shown in the image, when the number of itterations goes above the number of meshes in the array nothing is spawned in the world, the empty spaces should be following the pattern of the previous walls.

216084-1.png

So you have an array of length 10 but only the first 5 indexes are valid or have meshes to spawn.

If the iterator encounters an undesired object, like a null reference to a mesh, you could break the loop and restart. There is a loop with break in the blueprints.

Alternatively, validate current array element, if it fails, ignore the result.

I hope I got it right. Not sure why you’d want empty array indexes, though.