How to package a plugin dependent on another plugin?

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.

1 Like