Blueprints : Allow Map variables to map to arrays/sets

Can I put in a feature request for something that I think could prove quite useful (especially to me right now)

When creating a Map variable, it would be great if the value side could be set to be an Array or a Set rather than single variables.

Thanks

This would be a great way to create and categorize arrays on the fly. So I agree that this should be a feature.

1 Like

Reflection doesn’t support nested containers so this isn’t possible (and very difficult to support). This issue isn’t limited to Blueprints, you can’t have nested containers in C++ either if you want to support reflection.

What you can do though, is create a Blueprint Struct, add an Array to that and use that as the Map’s Value. In theory you can continue that chain forever, though I would question the design at that stage :wink:

Best way to deal with that would be a struct with pointer and wrapper functions for a private array…

When you store the array within the struct it becomes a nightmare of array copies everywhere.

True but OP was talking Blueprint and that kind of thing isn’t easily achievable there.

  1. Create an object.
  2. Assign the object a Get function on the output with an undefined array
  3. Create the object Heirs and, via the get function, give different types of arrays.
  4. Through the gett, working with the address of the array of the object, we can write (insert the element, set the array, swap, etc.). This is an example of how not to do a bunch of the same code. For me, it’s just as important as For Array Wildcard.

I tried doing that (create a struct with an array inside), but it consistently breaks the engine when I try to add anything to it.

image