TMap can find the value but can't return it?

Hello, I’m using a TMap on my actor so I can drag other actors into it and reference them easily in code.
I’ve been doing this all over the game and it’s always worked perfectly, but something’s not working right on this one:


UPROPERTY(EditAnywhere, Category = "AKQ|Assets") TMap<FName, AActor*> Actors;


	
for (auto& Elem : Actors){
	UT::Pop(Elem.Key.ToString(), !!Elem.Value);
}
UT::Pop("Contains", Actors.Contains("hurt"));
UT::Pop("Actors]", !!Actors"hurt"]);
UT::Pop("Actors.FindRef", !!Actors.FindRef("hurt"));

The UT::Pop() just prints a message to the screen.
When I run this code, it prints the following:

hurt: true
Contains: true
Actors]: false
Actors.FindRef: false

Why does it clearly see that there’s a ‘hurt’ element in the TMap, but it fails to actually find or use it? What’s going on here?

Edit: Apparently it just breaks on every compile, and I have to either add an empty element to the end, or remove that empty element.
The TMap has to be changed in some way every compile or everything is null.

I found something strange going on with TMap too, it seems related. I had just started using a TMap uproperty to store some pre-calculated data about my StaticMeshActors but whenever I press Play the table loses all its value data, becoming completely useless. At first I thought it was because of key pointers changing between editor and play, but using the actors’ name as key doesn’t resolve the problem like it should.

To be clear, it was working perfectly until two days ago, and I’m 99% sure I didn’t touch anything related to the TMap since my previous backup now shows the same behaviour. I’m now using UE 4.15.3 but I noticed this since the 3.0.1 update of the launcher.

I have the exact same issue, but yet on another function in a BlueprintFunctionLibrary it works just fine.

I did manage to solve this issue. For the value, always use another struct or class to store your value in.

Ex....

static TMap<TTuple<EGalaxyType, int32>, FTMapValue<double>> galaxySizes;

template<typename T>
USTRUCT(BlueprintType)
struct FTMapValue {
	UPARAM(DisplayName = "Value")
		T value;
};


This solved my issue.