I want to change a project to c++,but there is a problem,how can I access the struct define in blueprint from c++.
You can’t, you can redefine the struct in c++ then change the bp refs over to the one made in C++
Fine,thank you for your replay.
Actually there is a way to access BP struct variable via reflection system, everything oyu see in Blueprint can be done in C++, because blueprint is programmed in C++. But it’s more practical declaring structures in C++
Use UStruct.
Here the link How_To_Make_UStruct
Start by enumerating the properties:
UClass* MyBpClass = this->GetClass();
FProperty* MyPropertyLink = MyBpClass->PropertyLink;
while (MyPropertyLink)
{
FString MyPropCppName = MyPropertyLink->GetNameCPP();
FString MyPropCppTypeName = MyPropertyLink->GetCPPType();
UE_LOG(Log, Log, TEXT("Label [%s] Type [%s] ..."), *MyPropCppName, *MyPropCppTypeName);
FString Name = MyPropertyLink->GetName();
MyPropertyLink = MyPropertyLink->PropertyLinkNext;
}