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();
}
expect : RunFind finish properly
result : ensure occur of UMapTestDataAsset::RunFind()
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-177409 in the post.
12 |
Component | UE - Editor - Workflow Systems |
---|---|
Affects Versions | 5.0, 5.1 |
Created | Feb 17, 2023 |
---|---|
Updated | Jan 19, 2024 |