Packaging fails when including module/plugin that depends on LevelEditor


I created a plugin to add a custom button in the LevelEditor toolbar. The project compiles ok and the plugin is fully functional, but when I try to package it I get a BUILD FAILED.

It complains it cannot open include file “UnrealEd.h” filem which is included by LevelEditor.h. When I disable the plugin that adds LevelEditor as a dependency it packages ok.

I tried to add UnrealEd to the plugin’s public dependency module in .Build.cs file but then I get even more errors. It seems that UnrealEd depends on evetything. I’m using UnrealEngine 4.3

This is the output log: (right-click and then open in a new tab to see it full size)

This is the plugin’s .Build.cs file:

public BuildPlugin(TargetInfo Target)
	PublicIncludePaths.AddRange(new string[] {"BuildPlugin/Public",});
        PrivateIncludePaths.AddRange(new string[] {"BuildPlugin/Private",});

        PublicDependencyModuleNames.AddRange(new string[] { "Engine", "Core", "LevelEditor", "Slate", "EditorStyle" });

Does any of you EPIC! guys know how to fix this? (Does it have anything to do with a include of “LevelEditor.h” in another .h file in my plugin?)

Kind Regards,

Hi there,

I have recently been having a similar problem. I have come to realise that the LevelEditor.h includes UnrealEd.h and this header contains some code that is on run when in editor mode, therefore when running a plugin that depends on it in standalone/packaged it crashes.

A way to identify if the code will only run in editor is if it is surrounded by #if WITH_EDITOR_ONLY_DATA.

Not sure if this has helped you at all? I’m currently trying to find a way around it to include only what I need so that my plugin will work in a standalone build.

Also an additional hint for you, not sure if you know this already but in your .uplugin file there is a “Type” attribute, this determines when the plugin can be run/packaged. There are three different types including “Editor”, “Developer”, and “Runtime”. To find our more check out this link: Plugins in Unreal Engine | Unreal Engine Documentation

Hope this helped, also if you found a way around your problem I would appreciate knowing more! :slight_smile: