Adding "UnrealEd" module breaks build

Hi.
I am trying to add “UnrealEd” module as dependency into my plugin as I need to do some operations in the editor module, and it includes usage of ThumbnailTools.

I tried to add it like this into my BUILD file:

       if (Target.Type == TargetRules.TargetType.Editor)
	{

		 PublicDependencyModuleNames.Add("UnrealEd");
                 //also tried  PrivateDependencyModuleNames.Add("UnrealEd");
	}

Once I do it, the compiler starts spitting errors in my code for different modules as well as errors inside the other modules I have been using. All of the errors are of the form:
“undeclared identifier” or “is not a class or namespace”. This seems like the adding of “UnrealEd” module removes all the other modules. My other deps are these:

   PublicDependencyModuleNames.AddRange(
		new string[]
		{
			"Core",
			"AVEncoder",
			"UMG",
			"ImageWrapper",
			"CoreUObject",
			"CinematicCamera"
			// ... add other public dependencies that you statically link with here ...
		}
		);




	PrivateDependencyModuleNames.AddRange(
		new string[]
		{
			
			"Engine",
			"Slate",
			"SlateCore",
			"RenderCore",
			"AVEncoder",
			"InputCore",
			"RHI",
			"Projects" //needed for usage of IPluginManager
		}
		);

Tried to add “UnrealEd” before,after,together with the other depds ,but same thing. The build breaks.

2 Likes

same, any solution?

https://nerivec.github.io/old-ue4-wiki/pages/create-custom-engine-classes-for-your-game-module.html

If you want to add the Unreal Ed module to your plugin:
You can do it so in your PluginName.Build.cs file

		PublicDependencyModuleNames.AddRange(
			new string[]
			{
				"Core",
				"UnrealEd"
				// ... add other public dependencies that you statically link with here ...
			}
			);

However, then you need to set that plugin to be Editor type in your PluginName.uplugin file:

"Modules": [
		{
			"Name": "PluginName",
			"Type": "Editor",
			"LoadingPhase": "Default"
		}
	],

Otherwise it won’t compile or package, because the UnrealEd module cannot exist at runtime.

So, in my case I have a plugin where some features are editor time only (and requires UnrealEd) - and some thats runtime. I was hoping to just be able to omit editor only code using macro #ifdef statements. Will setting “Type” to “Editor” cause any issues for me when compiling for standalone?

My solution for this is to have 2 modules on my custom utilities plugin.

  • one editor module with things like UnrealEd
  • and one runtime module with only runtime-allowed things

Closest you can get to having your cake and eating it too :smiley:

Try add next line in the function public of YOURPROJECTNAMEEditor.Target.cs

IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;