2 Qs:
http://puu.sh/w9wcN/79d171eac4.jpg
This message appears both for components which don’t have an associated UPROPERTY, but also in simulate mode for dynamically created components in a UPROPERTY array. My question is, what is the reason for this limitation? I dug into the code a while back, found the line that enforced it, and managed to trick the editor into allowing editing by creating an unrelated dummy property with a name that matched. Everything worked fine, which makes me wonder if this restriction is perhaps old and could just be lifted.
I’ve seen the following in a few places in engine code:
UPROPERTY()
TMap< AActor*, Something > SomeMapProperty;
and this too:
TMap< TWeakObjectPtr< USomeObject >, Something > SomeMap;
I’ve wondered for a long time if this is safe, and if so how. In both cases, the object acting as the key can be destroyed. When the GC then comes along, assuming map properties with object keys behave in the same way to regular object properties, the key will be set to null. So you can end up with a map with multiple equal keys, which I’d think was undefined behaviour. Same for the weak ptr version. Am I missing something here, or is this only safe if it’s known for sure that nothing will be destroyed?
I may be misunderstanding the dilemma, but when I saw this it was because I needed to give UPROPERTY() a visibility specifier like this:
UPROPERTY(EditDefaultsOnly, Category = "UPROPERTY Example)
TMap< AActor*, Something > SomeMapProperty;
All the UPROPERTY() specifiers can be found here
At the time I was working with TMaps in my project (4.13.2) UE4 did NOT like when I exposed those containers to blueprints. Should be okay with 4.15+ now though since you can make them in BP!