How to get an object value from UStructProperty?

Greetings.

I have some UObject. I iterate over it’s fields with TFieldIterator. With simple types, like int, float, string I can get a value just calling prop::GetPropertyValue_InContainer(). But UStructProperty doesn’t have this field. I tried with FTheSimpleStruct::ContainerPtrToValuePtr but this method gives me a pointer pointing to a wrong value.

According to this question: Read variable value from UProperty of different types - Plugins - Unreal Engine Forums your approach ought to work. I’ll test it and see for myself.