Description

Customer created a custom DataTable with a TSet Property and saw the behavior of allowing duplicate elements within the TSet, which is not allowed. See TSet Documentation for more information.

This is a general problem with sets/maps of Structs, the FPropertyValueImpl::ImportText function does not correctly handle the case of modifying something inside a struct inside a map, the Set code needs to traverse up the property chain further

Repro Ratio: 3/3

Tested in //UE4/Release-4.27 @ CL#18319896 and the issue did occur there, it is not a regression.

This same issue occurs

Steps to Reproduce

SIMPLER REPRO

  1. Open the editor in any project
  2. Create a new Blueprint Structure called KeyStruct
  3. Add one member to it, a GameplayTag
  4. Open up any blueprint, create a new variable of type KeyStruct, and change it to a Set (or map, same issue occurs)
  5. Click + to add a new item, set the tag member to the first tag in the list
  6. Click + again, set the new tag member to the same tag
  7. Note that it allows two duplicate entries, which does not happen for sets of GameplayTag

ORIGINAL REPRO

  1. Create Blank C++ Project
    • for purposes of easy to understand repro steps I will refer to the project as MyProject
  2. Open MyProject.h in Visual Studio
  3. add include lines before the MyProject.generated.h include line:
    #include "GameplayTagContainer.h"
    #include "Engine/DataTable.h"
     
  4. Add following code underneath the include statements.
     USTRUCT(BlueprintType)
     struct FTestStruct_Inner
     {
          GENERATED_BODY()
     
          UPROPERTY(EditAnywhere)
               FGameplayTag myTag;
     
               bool operator==(const FTestStruct_Inner& ftsi){};
               bool operator!=(const FTestStruct_Inner& ftsi) {};
               friend uint32 GetTypeHash(const FTestStruct_Inner& hash) { return 0; };
     
     };
    
     USTRUCT(BlueprintType)
     struct FTestSTruct_Row : public FTableRowBase
     {
          GENERATED_BODY()
     
          UPROPERTY(EditAnywhere)
               TSet<FTestStruct_Inner> mySet;
     };
    
  5. In Editor go to Edit>Project Settings>Gameplay Tags
  6. Under Gameplay Tag Table List create a new DataTable implementing the new custom row type
    • Click the plus sign to add new table
    • In Dropdown select DataTable
    • Name your table and save
    • Choose FTestStruct_Row when prompted
  7. In Content Browser, open the new Data Table
  8. Add a new Row
  9. within the row, Add a new TSet element and create or choose a Gameplay Tag
  10. within the same row, add a second TSet element and choose the same Gameplay Tag

Blueprint Steps

  1. Create a new blueprint class
  2. Open Blueprint
  3. Create a new variable and choose type FTestStruct_Row
  4. In details panel add two elements to the TSet variable each with the same Gameplay Tag

Expected Result: With the TSet property the DataTable should not allow duplicate entries.

Actual Results: Duplicate entries are allowed and no indication within the Editor Console that this is an issue. However, when looking over logs you will see the following error:

Error: UDataTable::GetAllRows : Incorrect type specified for DataTable '/Game/PickUps.PickUps' (UGameplayTagsManager::PopulateTreeFromDataTable)

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-148872 in the post.

1
Login to Vote

Backlogged
ComponentUE - Editor - Workflow Systems
Affects Versions5.05.1
CreatedApr 12, 2022
UpdatedJan 19, 2024