Download

4.24 Deprecation of Developer Module Type & UncookedOnly Not Working on Nativized BP Assets

From 4.24 release notes:

The Developer type was used for editor modules that contain custom blueprint editors, graphs, and nodes. It could work through any of the editor play options. No other module type achieves this including the new DeveloperTool type.

The UncookedOnly replacement does work in all previous cases that the Developer type did, with one exception: when packaging a release build with blueprint nativization enabled for assets that were generated by this editor module. In this case the editor module is included along with the runtime module in the BpCodeGenManifest.json, when it clearly shouldn’t be. This fails to load of course as the module isn’t meant for cooked builds.

In 4.24 using the ‘Developer’ mode still works properly with the BpCodeGenManifest.json only containing the runtime module. I’ve compared the generated cpp files and I don’t see any real difference between them. It appears that the editor module is just being added to the manifest when it shouldn’t be.

This looks like a bug and I can create a issue, but if anyone has any suggestions first that would be great!

Figured out the problem and a work around.

The UnrealHeaderTool code generator doesn’t appear to take into account the new UncookedOnly type when setting package flags to determine what should be included in nativization.

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.



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);
    }

...

If you want to see where these flags are normally set you can find them under \Engine\Source\Programs\UnrealHeaderTool\Private\CodeGenerator.cpp



Package->SetPackageFlags(PKG_ContainsScript | PKG_Compiling);
Package->ClearPackageFlags(PKG_ClientOptional | PKG_ServerSideOnly);
if (Module.ModuleType == EBuildModuleType::GameEditor || Module.ModuleType == EBuildModuleType::EngineEditor)
{
    Package->SetPackageFlags(PKG_EditorOnly);
}

if (Module.ModuleType == EBuildModuleType::GameDeveloper || Module.ModuleType == EBuildModuleType::EngineDeveloper)
{
    Package->SetPackageFlags(Package->GetPackageFlags() | PKG_Developer);
}


These are then read in \Engine\Source\Developer\BlueprintNativeCodeGen\Private\BlueprintNativeCodeGenManifest.cpp to determine if the module should be included in the module references of nativized assets.



// we want only native packages, ones that are not editor-only
if ((DependentPackage->HasAnyPackageFlags(PKG_CompiledIn)) && !DependentPackage->HasAnyPackageFlags(PKG_EditorOnly | PKG_Developer) && !DependentPackage->IsLoadedByEditorPropertiesOnly())
{
    DependenciesOut.AddUnique(DependentPackage);// PkgImport.ObjectName.ToString());
}