TMap

TMaps are defined by two types, a key type and a value type, which are stored as associated pairs in the map.

Example of using a TMap as a UProperty

[UClass]
public class AMyShowcaseClass : AActor
{
    [UProperty(PropertyFlags.EditAnywhere | PropertyFlags.BlueprintReadWrite)]
    public TMap<int, string> MyMap { get; set; }

    protected override void BeginPlay()
    {
        base.BeginPlay();

        MyMap.Add(1, "First Value");
        MyMap.Add(2, "Second Value");

        UpdateMapWithKey(2, "Updated Second Value");
    }    
}

TMap can also be represented as an IDictionary inside of a UFunction

[UFunction(FunctionFlags.BlueprintCallable)]
public void TestDictionary(IDictionary<string, string> MyDict)
{
    PrintString($"Dictionary Key Count: {MyDict.Keys.Count}");
}

Last updated