New 'UncookedOnly' modules can incorrectly be included as a build dependency after nativization of a Blueprint asset

New 'UncookedOnly' modules can incorrectly be included as a build dependency after nativization of a Blueprint asset

The new 'UncookedOnly' module type that was added in 4.24 is not visible to Blueprint nativization, and thus it does not know to exclude these module types from the generated Build.cs file when they are found to be a dependency of the Blueprint asset.

Current suggested workaround (from the forums):

To get around this you can manually set the package flags. PKG_EditorOnly or PKG_Developer should work. You can see where they're normally set under CodeGenerator.cpp
I did this during module startup and it seemed to work without issue.
Code:
void FYourEditorModule::StartupModule()
{
const FString LongName = FPackageName::ConvertToLongScriptPackageName(TEXT("YourEditorModuleName"));
if (UPackage* Package = Cast<UPackage>(StaticFindObjectFast(UPackage::StaticClass(), nullptr, *LongName, false, false)))
{
Package->SetPackageFlags(PKG_EditorOnly);
}

Steps to Reproduce

For testing: See UE-84832 (Expected result: Match3 should continue to be able to be packaged successfully with nativization enabled after this fix).

Have Comments or More Details?

There's no existing public thread on this issue, so head over toAnswerHub just mention UE-86099 in the post.