Getting variable by name of unknown type using reflection system

Hello!

I know that i can use the reflection system to get the value of variable just by knowing its name but is there a way to get and set variable of any type meaning i dont what the type of variable is going to be exactly?. Since all i know is that i have to explicitly do something like UIntProperty or UFloatProperty Etc is there anyway i can just cast to exact type and set / get its value?

Yes, for starters you can get void pointer from any UProperty:

https://docs.unrealengine.com/en-US/API/Runtime/CoreUObject/UObject/UProperty/ContainerPtrToValuePtr/2/index.html

Void pointer in C++ are pointers to unknown type of variable (it most pure form of memory address containment) and can be casted to anything, ofcorse you need to know preemptively what it is to properly cast it and read it not to mention write it which may cause memory corruption if you do something wrong

Remeber that you can always check the property type with GetClass()

Also UIntProperty and UFloatProperty are parented to same class UNumericProperty:

https://docs.unrealengine.com/en-US/API/Runtime/CoreUObject/UObject/UNumericProperty/index.html

Which allows to read both types the same as alos quicly check what type of numeric value it is.

Hmm i know about void pointers. But i didnt knew about flat and int sharing the same property type. However i dont think i can just do a function in the <> part of Cast <>(). I can just do auto for the assignment part.