Hello!
After my plugin migration from UE 4.27.2 to UE 5.0.2, I can’t package plugin (in editor work well).
error: no member named ‘ClassGeneratedBy’ in ‘UClass’
const UBlueprint * BlueprintObj = Cast (Blueprint->GetClass ()->ClassGeneratedBy);
Here is my function:
FString UCP_BPL::GetBlueprintDisplayName (UObject* Blueprint)
{
FString str;
if (Blueprint)
{
const UBlueprint * BlueprintObj = Cast<UBlueprint> (Blueprint->GetClass ()->ClassGeneratedBy);
if (BlueprintObj != NULL)
{
TArray<UObject::FAssetRegistryTag> OutTags;
BlueprintObj->GetAssetRegistryTags (OutTags);
for (int i = 0; i < OutTags.Num(); i++)
{
UObject::FAssetRegistryTag Tag = OutTags[i];
if (Tag.Name.Compare (TEXT ("BlueprintDisplayName")) == 0)
{
str = Tag.Value;
break;
};
};
//str = BlueprintObj->BlueprintDisplayName; /// <-- work only in editor, can't build with this here. But it's simpler and faster method.
};
};
return str;
}
How to cast UObject to UBlueprint which work for package plugin ?
Maybe commented line instead of code above (it can’t package in UE 4.27.2) ?