Destroy the skeleton class before clearing the UBlueprint's generated class. This allows UBlueprintGeneratedClass::PostLoad (called during duplication) to correctly identify that it is not the authoritative class, and therefore not generate GC info

#jira UE-188776
#rb Phillip.Kavan

[CL 26109850 by dan oconnor in ue5-main branch]
This commit is contained in:
dan oconnor
2023-06-19 19:18:02 -04:00
parent 31a203e04a
commit 1065df6465

View File

@@ -193,17 +193,19 @@ void FKismet2CompilerModule::RemoveBlueprintGeneratedClasses(class UBlueprint* B
{
if (Blueprint != NULL)
{
if (Blueprint->GeneratedClass != NULL)
{
FKismetCompilerUtilities::ConsignToOblivion(Blueprint->GeneratedClass, Blueprint->bIsRegeneratingOnLoad);
Blueprint->GeneratedClass = NULL;
}
// Order unfortunately matters, as we want to allow UBlueprintGeneratedClass::GetAuthoritativeClass to function
// correctly for as long as possible:
if (Blueprint->SkeletonGeneratedClass != NULL)
{
FKismetCompilerUtilities::ConsignToOblivion(Blueprint->SkeletonGeneratedClass, Blueprint->bIsRegeneratingOnLoad);
Blueprint->SkeletonGeneratedClass = NULL;
}
if (Blueprint->GeneratedClass != NULL)
{
FKismetCompilerUtilities::ConsignToOblivion(Blueprint->GeneratedClass, Blueprint->bIsRegeneratingOnLoad);
Blueprint->GeneratedClass = NULL;
}
}
}