Is there any way to store an array in a tmap?

I’m trying to use a TMap as part of my dialogue system, where the tvalue is an enumerated reference to the current conversation node, and the value is an array of FString conversation options:

TMap<EConversationNode, TArray<FString>> testMap;

This produces an error, “Nested containers are not supported,” which is pretty unambiguous, but is there any way to make this work? I have tons of features that would be much easier to implement if I could use lookup tables, but that’s all predicated on being able to store arrays as TValues.

As a workaround, you can put the array inside of a USTRUCT, for example:

USTRUCT()
struct FConversations
{
    UPROPERTY()
    TArray<FString> Entries;
};

TMap<EConversationNode, FConversations> testMap;
6 Likes

Ooh that works, thank you! :slight_smile:

蓝图我就是这样弄的,是不行的

可用、可行,蓝图已尝试,稍后尝试C++版本

It worked! Many thx