Thank you, I’m trying to pass the UClass * as an argument to a function call AddProperty() while iterating over different value types.
auto AddProperty = &](const FName& Name, UClass* PropClass, UScriptStruct* Struct = NULL) { ... }
auto CollectProperties = &](MyElement* Element)
{
for (auto It = Element->IntValues.CreateIterator(); It; ++It)
// When compiling i get the following error:
// error C2664: 'void MyPlugin::MyFunction::<lambda_f7a202816d4305339f3c5d82defbfb03>::operator ()(const FName &,UClass *,UScriptStruct *) const': cannot convert argument 2 from 'FFieldClass *' to 'UClass *'
// note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
AddProperty(It->Key, FIntProperty::StaticClass());
for (auto It = Element->FloatValues.CreateIterator(); It; ++It)
// Same error here
AddProperty(It->Key, FFloatProperty::StaticClass());
}
Declaring a UClass* variable first doesn’t work either.
// When compiling i get the following error:
// error C2440: 'initializing': cannot convert from 'FFieldClass *' to 'UClass *'
// note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
UClass* propClass = FProperty::StaticClass();
This code used to work for version 4.22 using the UIntProperty::StaticClass() and UFloatProperty::StaticClass().