How to package a plugin dependent on another plugin?

Hi, suppose I have two plugins, MyPlugin and AdditionalPlugin. Both are game plugins. I’ve set AdditionalPlugin to be dependent on MyPlugin by modifying the MyPlugin.uplugin and MyPlugin.build.cs file, like so:

MyPlugin.uplugin

"Modules": [
         {
           "Name": "MyPlugin",
           "Type": "Runtime",
           "LoadingPhase": "Default"
         }
       ],
       "Plugins": [                       // <--
         {                                // <--
           "Name": "AdditionalPlugin",    // <--
           "Enabled": true                // <--
         }                                // <--
       ]                                  // <--

MyPlugin.build.cs

PublicDependencyModuleNames.AddRange(
         new string[]
         {
             "Core",
             "CoreUObject",
             "Engine",
             "AdditionalPlugin",          // <--
         }
     );

Now, I would like to package MyPlugin. Since AdditionalPlugin depends on MyPlugin, it seems that I can’t just simply package MyPlugin. Do I have to package AdditionalPlugin first and put it somewhere? When I try to package MyPlugin, this is the error I get:

Running AutomationTool...
UATHelper: Package Plugin Task (Windows): Parsing command line: BuildPlugin -Plugin=C:/Users/MyPlugin/MyPlugin.uplugin -Package=C:/Users/Desktop/MyPlugin -CreateSubFolder
[2018.11.22-23.44.20:319][488]UATHelper: Package Plugin Task (Windows): Copying 70 file(s) using max 64 thread(s)
[2018.11.22-23.44.20:423][494]UATHelper: Package Plugin Task (Windows): Reading plugin from C:\Users\HostProject\Plugins\MyPlugin\MyPlugin.uplugin...
[2018.11.22-23.44.20:456][496]UATHelper: Package Plugin Task (Windows): Building plugin for host platforms: Win64
[2018.11.22-23.44.20:457][496]UATHelper: Package Plugin Task (Windows): Running: C:\Program Files\Epic Games\UE_4.21\Engine\Binaries\DotNET\UnrealBuildTool.exe UE4Editor Win64 Development -plugin=C:\Users\HostProject\Plugins\SequenceGenerator\MyPlugin.uplugin -iwyu -noubtmakefiles -manifest=C:\Users\HostProject\Saved\Manifest-UE4Editor-Win64-Development.xml -NoHotReload -log="C:\Program Files\Epic Games\UE_4.21\Engine\Programs\AutomationTool\Saved\Logs\UBT-UE4Editor-Win64-Development.txt"
[2018.11.22-23.44.21:964][563]UATHelper: Package Plugin Task (Windows):   Using Visual Studio 2017 14.15.26726 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.15.26726) and Windows 10.0.16299.0 SDK (C:\Program Files (x86)\Windows Kits\10).
[2018.11.22-23.44.22:070][567]UATHelper: Package Plugin Task (Windows):   ERROR: Unable to find plugin 'AdditionalPlugin' (referenced via command line -> MyPlugin.uplugin). Install it and try again, or remove it from the required plugin list.
[2018.11.22-23.44.22:070][567]UATHelper: Package Plugin Task (Windows):          (see C:\Program Files\Epic Games\UE_4.21\Engine\Programs\AutomationTool\Saved\Logs\UBT-UE4Editor-Win64-Development.txt for full exception trace)
[2018.11.22-23.44.22:109][568]UATHelper: Package Plugin Task (Windows): Took 1.6590954s to run UnrealBuildTool.exe, ExitCode=5
[2018.11.22-23.44.22:115][568]UATHelper: Package Plugin Task (Windows): ERROR: UnrealBuildTool failed. See log for more details. (C:\Program Files\Epic Games\UE_4.21\Engine\Programs\AutomationTool\Saved\Logs\UBT-UE4Editor-Win64-Development.txt)
[2018.11.22-23.44.22:115][568]UATHelper: Package Plugin Task (Windows):        (see C:\Program Files\Epic Games\UE_4.21\Engine\Programs\AutomationTool\Saved\Logs\Log.txt for full exception trace)
[2018.11.22-23.44.22:134][569]UATHelper: Package Plugin Task (Windows): AutomationTool exiting with ExitCode=5 (5)
[2018.11.22-23.44.22:168][570]UATHelper: Package Plugin Task (Windows): BUILD FAILED
1 Like

I am also seeing this behaviour in 4.21.2. Is packaging plugins with a dependency on other plugins supported in UE4?

Bumping.

Since Unreal added the plugin dependency option in a more recent version (I believe 4.18 or so), there should be a way to package plugins depending on other plugins as well. I have tried doing so without success so far.

Hi!In plugins :
1)You can select when this plugin is loaded Default,etc
2)You should regenerate your project,if you include your second plugin as a dependency
And its possible to make any kind of hierarchy that you want in plugins.
if you will not get any success,just drop here the link to the source i will check.Cheers!

Hi, was a resolution ever found for this? Got the exact same situation and getting the error:

UATHelper: Package Plugin Task (Windows): ERROR: Unable to find plugin ‘MyPlugin’ (referenced via command line → AdditionalPlugin.uplugin). Install it and try again, or remove it from the required plugin list.

If I remove it from the dependency list, it gives an error that the includes for the dependant plugin can’t be found.

1 Like

In case anyone else comes across this issue.
You need to add the dependency plugin to the folder 'Engine\Plugins' then UE will find the dependency and compile.

For example, if MyPlugin depends on AnotherPlugin, add AnotherPlugin to the folder Engine/Plugins/AnotherPlugin

Hope this helps :slight_smile:

Hi, resurrecting this because in UE 5.4 copying the depended-on plugin to the Engine/Plugins/ folder does not work. It will produce the following error:

Expecting to find a type to be declared in a module rules named ‘AdditionalPlugin’ in ‘UE5Rules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’. This type must derive from the ‘ModuleRules’ type defined by UnrealBuildTool.

Are there instructions on building a plugin using Automation Tool (with the “BuildPlugin” command) that depends on another plugin?

May I ask if you have resolved this issue.

Yes, but it required writing my own custom Automation Tool command (which requires an engine source build).

With further research I discovered that it is not possible to build a plugin (using the “BuildPlugin” automation tool command) that depends on another plugin. It is simply not a supported feature. IMO this is a pretty big oversight, and teams that use plugins as part of their workflow need this.

I don’t have time to write up a full walkthrough of how to do it, and I can’t simply dump the code because it’s a modified version of Epic’s code. But here’s a rundown:

The theory:

  • Inside the BuildPlugin command, it first makes a new project directory where it copies in the plugin you are building
  • It then uses this dummy project to run UBT and compile the plugin, before copying the compiled plugin to the output directory.
  • What you need to do is also copy in any dependent plugins into the dummy project before compiling.

So the broad strokes steps to implement it are:

  • Make a copy of BuildPluginCommand.Automation.cs
  • Add a new argument called “DependentPlugin”, which is the path to the uplugin we depend on (you could also implement this as an array of dependent plugins, if you need multiple).
  • Inside the CreateHostProject function in the command, also copy in the dependent plugin that was specified in the arguments, in the same fashion that the main plugin is copied.

In theory this is simple, but I wouldn’t call writing automation tool commands a beginner-friendly programming task. I recommend bugging Epic to add this feature to their automation commands, as again it’s a pretty big oversight IMO.

Ok