Download

Having trouble with structs and converting an array of actors back to an array of objects

Hi.
I’d like to create an array of arrays and will use structs for that task.
I have three arrays array_box_1, array_box_2, array_box_3. They are of type box which is a blueprint derived from actor.
What I’m trying to achieve is selecting one of these arrays at random

In the image below I’ve created a variable that is an array of actors. I’ve created three of these one for each array.
Then in the blueprint I set the struct variable to the array and then use a make array to create an array of the three struct variables.

The problem I’m having is with the “Get” node because it is treating the arrays as arrays of actors and not arrays of boxes and want let me do the usual array stuff i can do on arrays of an object.

Advice would be great.

Thanks.

I suggest you use an array of actors, it’s easy to achieve the right element from it with this formula

x + (ArraySize* Y)

This and when you get it right make PURE functions that get your element out of array given X and Y. Just hide that formula in pure function.

Yeah, I’ve made it before

two functions for Set and Get with 2D Array
you could change the variable type for other data types

Set Item
Annotation-20181107-161545.jpg

Get Item
Annotation-20181107-161627.jpg