TMap Struct value is not editable in components inherited from C++

Hello again,
since 4.14 added support for TMap in editor I wanted to check it out. Here’s a list on how to reproduce the bug I have found, and some screenshots for quick reference.

  1. Create New Project - Basic Code

  2. Create New C++ Class - based on Actor (MyActor)

  3. Create New C++ Class - based on ActorComponent (MyActorComponent)

  4. Change code in MyActorComponent.h to:

    USTRUCT(BlueprintType)
    struct FMyStruct
    {
    GENERATED_BODY();

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Test")
    float MyFloat;
    

    };

    UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
    class MYPROJECT_API UMyActorComponent : public UActorComponent
    {
    GENERATED_BODY()

    public:
    UMyActorComponent();

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Test")
    	TMap<uint8, FMyStruct> MyMap;
    

    };

  5. Add following lines to MyActor.h

    UPROPERTY(Category = “Test”, VisibleAnywhere, Instanced, BlueprintReadOnly)
    class UMyActorComponent* MyComponent;

  6. Change constructor in MyActor.cpp to:

    AMyActor::AMyActor() : MyComponent(CreateDefaultSubobject(“MyComponent”))
    {
    PrimaryActorTick.bCanEverTick = true;
    }

  7. Create Actor blueprint based on MyActor and check MyMap in MyComponent .

  1. For a workaround, go back to MyActorComponent.h and add the following:

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = “Test”)
    TArray MyArray;

  2. Now TMap value can be changed from editor

Conclusion:

UStructs used as Values in TMaps used in ActorComponents inherited from C++ are not editable in editor, unless a TArray is added in the same C++ class. ActorComponents added from editor does not have this issue.

I’m just curious, did you enabled them in Editor Setting > Content Editor > Blueprint Editor> Experimental > Enable (incomplete, non-working) support for TSet and TMap?

I have that option disabled. Now I’m curious, should it be checked? I don’t see any difference.

Haha, yes of course it is stated there in name of checkbox what it is for :stuck_out_tongue: mark it :slight_smile: Tell the difference :slight_smile:

You probably need to restart editor after enabling it as well. So it can load up with fresh config. To be sure recompile your blueprints that use this feature as well.

Sorry for late reply, I’ve checked “Enable (incomplete, non-working) support for TSet and TMap” option, recompiled MyActor blueprint, restarted editor, and even created new Blueprint after that. Struct value is still not visible/editable from editor, just like you can see in screenshots. Can anyone reproduce it?

It says Incomplete, non-working either way so I would personally do not expect wonders :slight_smile: Sure guys at Epic already looking at this. At least I hope.

Yeah, I guess so :smiley: After reading release notes for 4.14 I thought TMaps are supported officially. At least there’s a workaround for my case.

Anyway, thank you very much for replying :slight_smile: since you were the only person interested.

No problem man! I might need them soon as well :slight_smile:

Hi ,

I looked into this today, and was able to see the same results that you described. I have entered UE-39260 to have this investigated further.