I was working on custom asset and noticed I’m having some errors with project packaging.
After narrowing down possible errors I’ve came down to the fact having UFactory in Editor module produce error during package
UnrealBuildTool: Error: Couldn't find parent type for 'CustomAssetFactory' named 'UFactory' in current module or any other module parsed so far.
These are modules I have currently.
"Modules":
{
"Name": "TestGame",
"Type": "Runtime",
"LoadingPhase": "Default"
},
{
"Name": "CustomToolEditor",
"Type": "Editor",
"LoadingPhase": "PostEngineInit"
}
After narrowing error down I have no editor dependent code in my runtime module, even WITH_EDITOR blocks of code are temporary commented out.
CustomToolEditorModule only contains startup and shutdown methods.
#pragma once
class FDialogueToolEditorModule : public IModuleInterface
{
public:
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};
.cpp has basic definition and
IMPLEMENT_GAME_MODULE(FCustomToolEditorModule, CustomToolEditor);
inside
UFactory derived class seems almost empty as well.
#pragma once
#include "CustomAssetFactory.generated.h"
UCLASS()
class CUSTOMTOOLEDITOR_API UCustomAssetFactory : public UFactory
{
GENERATED_BODY()
virtual UObject* FactoryCreateNew(UClass* Class, UObject* InParent, FName Name, EObjectFlags Flags, UObject* Context, FFeedbackContext* Warn) override;
virtual bool CanCreateNew() const override;
};
Build.cs has UnrealEd module only enabled for editor
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string] {
"InputCore",
"Engine",
"Core",
"CoreUObject",
});
if (UEBuildConfiguration.bBuildEditor)
{
PrivateDependencyModuleNames.Add("UnrealEd");
}
PrivateDependencyModuleNames.AddRange(new string] { "TestGame" });
I don’t really understand why editor module (along with UFactory) is getting hooked up when is marked as Editor module. What is happening?