Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

TMap replication still not supported?

TMap replication still seems unsupported, or am I doing something wrong?

A mention of this is here already: https://forums.unrealengine.com/showthread.php?13133-TMap-lt-gt-Replication-exposing-to-Unreal-reflection&p=446346&viewfull=1#post446346

Trying to get it to replicate seems to always lead to "Deprecated Code Path" in PropertyMap.cpp

 bool UMapProperty::NetSerializeItem( FArchive& Ar, UPackageMap* Map, void* Data, TArray<uint8> * MetaData ) const
     UE_LOG( LogProperty, Fatal, TEXT( "Deprecated code path" ) );
     return 1;

Product Version: UE 4.11 Preview
more ▼

asked Feb 27 '16 at 06:31 PM in C++ Programming

avatar image

138 9 10 163

avatar image soulsource_ag Nov 23 '16 at 09:54 AM

To add a little more info, the relevant part of the call stack: http://pastebin.com/KQW1qrtn

avatar image NewZulund Mar 26 '17 at 09:35 AM

I'm getting the same issue/crash with a blueprint struct containing a tmap from GUID -> Blueprint struct.

avatar image Atheist91 Sep 17 '17 at 10:58 AM

Getting the same results in 4.17 :[

avatar image Atheist91 Jan 28 '18 at 12:08 AM

..and 4.18

avatar image Mercus Mar 05 '18 at 10:16 PM

Has anyone tried in 4.19? Right now still using UStructs in many places where TMap would just fit a lot nicer if properly supported with replication. As useful and amazing as structs can be in few places TMap would just be so much cleaner to use in my project.

avatar image Amneri Jul 02 '18 at 06:12 PM

Same for 4.19. Are TMap going to be replicated any time soon ? I mean, it seems like something pretty much essential.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I am posting this in case it might be useful as a simple starting place for someone. Tested in 4.19 only, and only for simple types (ie. FString). The TMAP is placed inside of a USTRUCT where NetSerialize moves key/values between TMAP and TARRAY's before/after network transport.

 struct FStructWithMap
     UPROPERTY(EditAnywhere, BlueprintReadWrite)
     TMap<FString, FString> StringMap;
     TArray<FString> StringKeys;
     TArray<FString> StringValues;
     bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
         if (Ar.IsLoading())
             // Move data to Map
             Ar << StringKeys;
             Ar << StringValues;
             for (auto It = StringKeys.CreateConstIterator(); It; ++It)
                 StringMap.Add(StringKeys[It.GetIndex()], StringValues[It.GetIndex()]);
         } else {
             // Move data to Arrays
             Ar << StringKeys;
             Ar << StringValues;
         bOutSuccess = true;
         return true;
 struct TStructOpsTypeTraits<FStructWithMap> : public TStructOpsTypeTraitsBase2<FStructWithMap>
         WithNetSerializer = true
more ▼

answered May 08 '18 at 05:51 PM

avatar image

41 3 2

avatar image Vaclav.Jarko Aug 26 '18 at 07:44 PM

Well it's not good. Work around is just mess

avatar image marineuac Nov 09 '18 at 07:06 PM

this is the cleanest implementation of tmap replication workaround i have seen so far.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question