TMap<> Replication - exposing to Unreal reflection.

Would it be possible to expose TMap to reflection system and by extension to replication ?

I have run my self in cases where I’d really like to have some sort of ordered list, where order of data is important and should be maintained. One of that case is mapping input to action bar and/or inventory where I really need to maintain certain order of items.

I have hacked solution around by using Struct with ID variable, but it’s not efficient, since something like TArray can be only be really searched linearly, and by that can’t be really used for bigger amounts of data and still be efficient.

Bumping because I need this as well.

For my GameState, I’d like to create a dictionary/map where the teams are the keys and values are the scores. TMap replication would be great for this, because now I have resort to a not-so-nice alternative.


Could we get at least information, if that’s possible/planned or just not wort time working on exposing it back to reflection/editor ?

I just found another use case where using TMap would be benficial. In UDataAsset for storing information about items, where they could be fast searched.
Currently I use TArray, but you can imagine that linear search with more than 100 items might start to be problematic when there need to be performed several of such searches at once.

Triple Bump!

Please add blueprint/network support for all important container types. Arrays are nice and all but… it’s arrays, and they are very limited.

I really figured this would have been a higher priority for epic since container types are fundamental and their use-cases are enormous.


I do recall reading somewhere on answerhub that it can be implemented in custom source and has been by some users but I have yet to find any source showing the implementation. After checking the source it looks like to implement TMap for BP and replication you need to add support for UE4’s serialization and reflection yourself and the replication part should be a snap. It’s the first parts that seem daunting. I wish I could do it myself but my c++ is very limited as the bulk of my experience is in managed languages (c# mainly).

Hi all,

Just a quick update to let you know that this feature is being worked on and we’re hoping to have something in a near-future release.

There have repeated demands and several attempts over the years to address this; it’s certainly not a ‘snap’. The first iteration will likely just involve basic serialisation and reflection, with deeper editor and BP support coming later.

That’s awesome to hear! Even basic exposed functionality will be much better than not exposed at all! :wink:

That’s great news! Implementing a UMapProperty and supporting TMap replication was on my todo list in 1998. :slight_smile:

Sorry to bump such an old thread but is there any update on this? Being able to serialize maps so they can be used in the editor would be a serious plus.

Initial support for TMap properties was added recently:

This should be regarded as WIP, but it currently supports reflection, text conversion, garbage collection and delta serialisation.

Editor support is basic - currently maps just show up as text edit fields - but we’re hoping to improve on that in the near future:

UPROPERTY(EditAnywhere, Category=TestMap)
TMap<int32, FString> LetsSeeIfThisWorks;

LetsSeeIfThisWorks.Add(0, "Test: 1");
LetsSeeIfThisWorks.Add(1, "Test: 3");


No blueprint support yet.


Awesome! Thank you!

Bump, any new info on TMap reflection and replication?

We’ve got a big thread going at the moment on Multiplayer / Networking feature list and hardening pass. See my sig and someone post it there!

EDIT: If TMaps support serialization - then I believe they also support replication. You’ll have to test that though, I’m not 100%

EDIT 2.0: I’m wrong.


I was just attempting to use this and was getting to a deprecated function call (This one,

Well, the source said it was deprecated, though the docs don’t reflect that. This was on 4.10.1. Did I set something up incorrectly to cause it to go down that codepath or is there an issue there?

It also appeared that I can’t use UStructs as keys to TMaps if I want them to replicate. This gave compiler errors saying it’s unsupported.



UStructs as TMap keys are supported but you have to provide certain operator overloads / a key hash

You shouldn’t have to manually call NetSerialize on the TMap - that should happen on it’s own when the actor gets its next replication pass

UStructs can’t be used as map keys if the map is declared as a UPROPERTY.

As for the other issue @skyphyr, did you find anything out? I just ran into this myself. I can only guess that TMap replication is still unsupported. Or has anyone else managed to get it working somehow?

So… TMaps can’t be replicated yet?!

Was just sumbling over that part in the post…
What about the FindByPredicate() method ? Does this also just do a linear search internally?
I somehow thought that it would be more efficient than a loop…

what the ****, is this ****

i cant believe this tmap does not replicate. gosh, what the hell is wrong with unreal developers.

if something does not work at all please remove it… now I will need to change all my code

There are better ways. It’s not exactly efficient to replicate them anyway. TMaps work fine, they just don’t support replication (like the vast majority of other UE containers and types).

Also, don’t swear pls. Forum Rules

Has anyone actually tested this before bleating on about it’s lack of support? I know maps that are created by BP don’t support it, but if you create them in C++ and provide a NetSerialize function for your custom USTRUCT, it may work.

I don’t understand why it’s so difficult to replicate a TMap, what are the programming challenges involved? Any situation I can think of has an obvious solution.