Description

If TMap's Key is a unique Struct, TMap's rehash will not run even if elements are added or changed in DetailPanel such as DataAsset. So TMaps's Find etc. will fail

This issue is very similar to [Link Removed]. However, in this case FPropertyValueImpl::ImportText cannot get the FMapProperty, so the fix code in [Link Removed] will not work.

It is possible to avoid the problem by calling rehash on the project side as below.

void UMapTestDataAsset::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
    Super::PostEditChangeProperty(PropertyChangedEvent);
 
    FMapProperty* const MapProperty = CastField<FMapProperty>(PropertyChangedEvent.MemberProperty);
    FScriptMapHelper ScriptMapHelper (MapProperty, &Records);
    ScriptMapHelper.Rehash();
} 
Steps to Reproduce
  1. Open attached project
  2. Open MapTestDataAsset
  3. Add 4 Items
  4. Press RunFind of MapTestDataAsset

expect : RunFind finish properly
result : ensure occur of  UMapTestDataAsset::RunFind()

Have Comments or More Details?

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

12
Login to Vote

Backlogged
ComponentUE - Editor - Workflow Systems
Affects Versions5.05.1
CreatedFeb 17, 2023
UpdatedJan 19, 2024