Packaging error: Non-editor build cannot depend on non-redistributable modules

This is a question that I know has come up before. I’ve looked at some existing answers:

I’ve attempted to implement the fixes they recommend, and I’m trying to package our project for windows 64-bit and still getting this error. My Build.cs looks like this:

using UnrealBuildTool;
    
    public class MyGame : ModuleRules
    {
    	public MyGame(TargetInfo Target)
    	{
            PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Slate", "SlateCore", "HeadMountedDisplay", "RHI"});
    
            MinFilesUsingPrecompiledHeaderOverride = 1;
            bFasterWithoutUnity = true;
    
            if (UEBuildConfiguration.bBuildEditor)
            {
                PublicDependencyModuleNames.AddRange(new string[] { "UnrealEd", "UMG", "XmlParser" });
                PrivateDependencyModuleNames.AddRange(new string[] { "XmlParser" });
            }
        }
    }

As you can see I’ve already got an editor module where I’m keeping all my editor specific stuff. I’ve also tried just pushing any extra modules into the if(…bBuildEditor) just on the chance that any of them are editor specific.

I’ve combed through my code to see if there’s anywhere in my normal game runtime where I’m including UnrealEd.h and there is one place. I’m surrounding it with #WITH_EDITOR pragmas, but I have no idea if these work for includes? (I have tried commenting this include and the code that uses it out, and I still can’t package so it’s not that anyway)

I’m out of ideas now as to where this issue might be coming from, does anyone have any suggestions?

Cheers!

Hello , could you provide the full log file from one of these failed packaging attempts? Using #WITH_EDITOR for the headers should work if I remember correctly and your build.cs looks correct, so I can’t tell what the issue is off the top of my head.

Hi Matthew, thanks very much for getting back to me! Actually I think I’ve begun to work this out, but I don’t feel comfortable to answer it yet. I BELIEVE it’s 2 things the first, is in my uproject I had the line:

"AdditionalDependencies": [
        "Engine",
        "CoreUObject",
	    "UMG",
        "UMGEditor"

I don’t know when or why I added this, but by removing “UMGEditor”, I had some luck packaging.

The other issue I had is outlined in my most recent question:

I have some UFUNCTIONS and UPROPERTIES declared within WITH_EDITOR pragmas. It seems as soon as variables or functions are marked with this they will not be packaged properly, the code in a non-editor build is still looking for them. This is a bit of a problem, primarily because I’m using quite a few blueprint variables, that are meant to be editor only for quality of life whilst editing data. Do you have any idea what I could do to solve this issue? Or is it simply a case of not being able to have editor only blueprint variables/functions?

Hello ,

I apologize for the delay, but after looking at your other issue, I don’t believe that can be done due to how the generated classes are done. In my experience, the any packaging attempts fail as the generated.h has the editor-only variable but the packaging isn’t taking it into account.