Following the documentation, Plugin will NOT package for UE 4.20 for marketplace?

I’m trying to update my plugin for 4.20, but it refuses to package. I’m using an identical packaging process that I did in 4.18 and 4.19…

My plugin, and all associated files are here:


This is what my build.cs looks like:

// Copyright (C) Stormtide Ltd. 2018. All Rights Reserved.

using UnrealBuildTool;
using System.IO;

public class ST_SparseGrid : ModuleRules
    public ST_SparseGrid(ReadOnlyTargetRules ROTargetRules) : base(ROTargetRules)
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
        bEnforceIWYU = true;


        PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine"});

I’m running the following command, exactly as described in the documentation:

 "E:\Program Files\Epic Games\UE_4.20\Engine\Build\BatchFiles\RunUAT.bat" BuildPlugin -Plugin="C:\Users\James\Desktop\STSG_420\ST_SparseGrid.uplugin" -Package="C:Users\James\Desktop\ST_SparseGridBuild" -Rocket

This is the error spat out by UAT:

  C:\Users\James\Users\James\Desktop\ST_SparseGridBuild\HostProject\Plugins\ST_SparseGrid\Source\ST_SparseGrid\ warning: Referenced directory 'E:\Program Files\Epic Games\UE_4.20\Engine\Source\ST_SparseGrid\Public' does not exist.

Why is UBT / UAT looking in the engine directory for my plugin files and content - it should be looking where I’m building the plugin from?

I’m also unable to package it from the editor for exactly the same reason. If this behaviour has changed, why are there no release notes on it?

I think I saw somewhere you no longer need to include those paths, but you could also try:

PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public"))

That just told me that “Path” does not exist in the current context. Back to the drawing board with that one!

If I remove the IncludePaths paths, it just tells me that any files in those folders can’t be found - so I guess I still need them.

Thats strange…were you still including using System.IO; when you got that error?

Oops… gotcha. It still won’t find any of the paths of my .h files though :confused:

You need to use full relative paths from the PublicIncludePath directory you are adding. So if ‘Folder1’ is a subfolder inside ‘ST_SparseGrid/Public’ of try something like

 #include "Folder1/File.h" 

I guess they must be enforcing that now then. I never had to do that prior to 4.20.

That’s correct @dingtech; as of 4.20, base include paths relative to the “Public” directory of Engine source files have been added to reduce the number of public include paths needed for Engine modules. However, you may use ModuleDirectory and EngineDirectory properties if you’d like to root to a particular directory. As you folks have already figured out, if you’re u[FONT=courier new]sing System.IO; the following syntax can be used where “MyFolder” is the name of the directory under the current module you’d like to include:
[FONT=courier new]PublicIncludePaths.Add(Path.Combine(ModuleDirectory, “MyFolder”));

@Monomyth I’ve made these changes, I’m still having trouble compiling. The directories are being found now with the above change (although it’s kind of annoying having to list all the sub-folders manually now).

        PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public"));
        PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public/Components"));
        PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public/Grid"));
        PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public/Utilities"));

        PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private"));
        PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private/Components"));
        PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private/Grid"));
        PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private/Utilities"));

The problem now is, it’s complaining about files not including headers in the correct order - even though they are. Here’s the log from UAT:

ProcessResult.StdOut:   Reflection code generated for UE4Editor in 14.4092065 seconds
ProcessResult.StdOut:   C:\Users\James\Desktop\Users\James\Desktop\ST_SparseGridBuild\HostProject\Plugins\ST_SparseGrid\Source\ST_SparseGridEditor\Private\Slate\ST_SGDataDetails.cpp(1): error: Expected ST_SGDataDetails.h to be first header included.
ProcessResult.StdOut:   ERROR: Build canceled.

And here is the file in question. You can clearly see that ST_SGDataDetails.h IS the first included file. I’ve never had so much trouble compiling anything…

// Copyright (C) Stormtide Ltd. 2018. All Rights Reserved.

#include "ST_SGDataDetails.h"
#include "DetailLayoutBuilder.h"
#include "DetailCategoryBuilder.h"
#include "IDetailGroup.h"
#include "DetailWidgetRow.h"
#include "SNumericEntryBox.h"

#include "Editor.h"

// Extras
#include "ST_SparseGridData.h"

I see you’ve already added:
[FONT=courier new]PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
to your plugin’s .build.cs file(s), but the errors guiding you to be IWYU-compliant seem to be erroneous (if the first header expected is, in fact, the first one included). If you’re compiling in VS, are you clearing Binaries/Intermediate folders before attempting the build with a new .sln? If that doesn’t work, make sure to try to build the plugin from the editor or directly invoke UAT’s BuildPlugin command.

Thanks - I ended up building through the editor instead, and got some different errors (related to IWYU) which I set about fixing, and everything was fine after that. I’ve finally been able to submit to the Marketplace! Strange that the editor vs invoking UAT directly would create different errors mind…

Im getting the same issue where its looking for the plugin public folder at the Engine directory, rather than where im building it from, however i have alredy added using System.IO and the Public & Private include paths

using UnrealBuildTool;
using System.IO;

public class MeleeTrace : ModuleRules

    public MeleeTrace(ReadOnlyTargetRules Target) : base(Target)
        PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;

        PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public"));
        PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private"));

            new string]

            new string]


            new string]


It compiles just fine trough both VS and the editor. however using the UAT BuildPlugin command fails with this error

\MeleeTrace\MeleeTrace.Build.cs: warning: Referenced directory 'C:\Program Files\Epic Games\UE_4.20\Engine\Source\MeleeTrace\Public' does not exist.

Some plugins have a Classes folder which are usually private, make sure if that one has one and add it to the list:

PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Classes"));

Thanks, However im not using the classes folder for my plugin ( just public and private ), So it still continues to fail with the same error

Try [Regenerate Project Files …] then build once more.

Be interested to know what the results are for previous two posts.

Yeah its broken. More infinite wisdom.

ModuleDirectory does help anyone when your solution has a dozen custom modules. You can reference the current module, or Engine Module, but not a seperate module. This change has gone from people not understanding how the build.cs files work, to the build.cs files simply not working.

I still reference external plugin modules in my build.cs and works just fine.