1 Like
The address passed to GetPropertyValue should be the address of the member variable, not the owner object. For example:
UClass MyObject : UObject
{
UPROPERTY()
int32 A;
UPROPERTY()
int32 B;
}
void Foo(MyObject* Object)
{
UClass MyObject : UObject
{
UPROPERTY()
bool A;
UPROPERTY()
bool B;
}
void Foo(MyObject* Object)
{
FBoolProperty* PropB = CastField<FBoolProperty>(Object->GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(MyObject, B)));
PropB->GetPropertyValue_InContainer(Object); // OK
PropB->GetPropertyValue(&Object->B); // OK
PropB->GetPropertyValue(Object); // Wrong
}
}