Procedurally create a variable

Hi all,
I’d like to procedurally create a variable.

What I mean by this is I would like to, during runtime, create an array, add items to it (I can already do this), but also give it a name (for example have an array of names and choose a name to give to that array)

How is this done?

make a struct with 2 elements. the first element is a Name called “title”, and the second element is an array of Names called “ArrayOfNames”

then you can make an array of these structs in a blueprint actor. to make a new named array, you would Make the struct, and Add it to the array.

but if your contents and your title are the same type, you might just want to use an array of names, and just consider the first entry to be the title, because arrays inside of structs inside of arrays are hard to edit in blueprint. setting the inner array is tricky: you need to copy the inner array into a non nested array of a similar type, then rebuild the outer array using that copy. otherwise the inner array changes wont save.

in C++ nesting arrays works very easily. but in blueprint, it can cause a lot of headaches. i would recommend avoiding nested arrays, even if it means splitting up your data into separate arrays, or even separate objects. you could always make a blueprint object that contained an array and a name, and you could have an array of those objects. it is a bit more expensive, but a lot easier to edit.