I set up an blueprint C++ class that accept a custom data asset with TMap like this
TMap<FName, UDataDefinition*> Definitions
.
Then I added 1 element into the tmap in blueprint, and in begin play I start iterating the the map
for (const TPair<FName, UDataDefinition*>& data: Definitions)
{
UE_LOG(LogTemp, Warning, TEXT("loop definition"))
dosomething(data.Value);
}
and it print twice but there is only 1 element in the map.
Warning LogTemp loop definition
Warning LogTemp loop definition
Then it crash due to invalid access as the second loop do not have valid pointer
Can anyone help me with this? thank you.
I try to use Definitions.Compact();
and Definitions.Shrink()
it do not work.