Duplicate key checking in maps and sets in the editor is done via calls to FScriptMapHelper::HasKey() and FScriptSetHelper::HasElement(), but this code is checking for object names which are subsets of existing keys, and so incorrectly reports duplicate keys when adding such a new key.
This is fundamentally an editor issue rather than a Core issue. These two functions are inappropriate for these helpers and should be relocated to the editor as part of any fix.
UCLASS() class AMyActor : public AActor { GENERATED_BODY() }; UCLASS() class AMyActor2 : public AActor { GENERATED_BODY() }; UCLASS() class AMyActorReference : public AActor { GENERATED_BODY() UPROPERTY(EditAnywhere, Category = "TestMap") TMap<UObject*, int32> TestMap; };
Expected: Setting the key works.
Actual: A 'duplicate key' error is raised.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-140406 in the post.
1 |
Component | UE - Editor - Workflow Systems |
---|---|
Affects Versions | 4.27, 5.0 |
Created | Jan 27, 2022 |
---|---|
Updated | Jan 19, 2024 |