Plug-in versus modules


Is there any performance discrepancies between a plug-in and a module?

Does a plug-in can be only activated for Client or Server? I know module can be as you can specified that in Target/Build files, but for a plug-in???


The plugin system is something that could really use some more clarification from Epic in the documentation.

Plugins (usually) will contain one or more modules, and can also optionally contain their own content. So in a sense they’re a higher level construct than a module.

As for client/server, it’s a little confusing because when you’re talking about runtime plugins (as opposed to plugins that only function within the editor), by default UE actually links them in statically at build time, so they’re not really ‘plugins’ at all. You do however have full control over if/when the modules in your plugin get loaded, so you could do it all dynamically based on whether you’re a client/server. Whether there is an easy way to configure the build system to include/exclude based on this, I’m not sure.

I didn’t know that. I only knew that you can load it depanding of the environment (runtime, editor, …) but not on demand. How do you proceed?


A Plugin is an external package that contains one or more modules and can be “installed” into your project.

So if you want to control the activation of a plugin, you have to control the activation of that plugin’s modules instead

You can configure the module within your uplugin file as “LoadingPhase”: “None”, which will prevent it from loading at startup even if the plugin itself is enabled.
Then call FModuleManager::LoadModule in your code to load it by name when you need it.

Last time I checked (just now) plugins with their own content were still a “work in progress” according to Documentation - Plugins. Although it wouldn’t surprise me if that page was outdated (given that it says 4.9 at the top and we’re at what 4.12.3? now). Although I believe a couple of the plugins that come with the engine also come with content so it is probably in an state where it can be used to some degree.

Also I think I read somewhere that plugins aren’t meant to depend on other plugins (never understood the reasoning behind this). While (engine) modules CAN depend on other (engine) modules. But maybe I misunderstood something or my brain is failing me :slight_smile:

I was also under the impression that plugins can’t really include their own content as well. Usually when I send a plugin to someone I send them a zip file with the content and tell them to extract it into their projects content folder. Has this problem been solved?

Yeah, definitely don’t trust anything written in the documentation! :confused:
As you say, Paper2D is implemented as a plugin with content, and that’s been around for ages (well before 4.9). From what I can tell, someone at Epic sporadically goes through the docs at random and stamps whatever the latest engine version is at the time at the top of the page. Once in a while they might actually read it to check if it needs amending, but generally not.

Plugins with content are live now on the marketplace too - I have a couple myself, I hope they work!

The line about distributed plugins with content probably relates to what I was saying above, in that support for content in a true plugin that you can build and distribute independently of the project likely does not yet exist. For ‘plugins’ that are linked monolithically into your project (the default), plugin content just gets cooked along with project content, so it’s all good.

As for plugins depending on other plugins, I think it just goes against the general idea of what a plugin is - it’s not supposed to have any dependencies other than the thing it’s being plugged into. There are some great answers by Epic’s Max Preussner that I’ve bookmarked on this topic:

Unfortunately though this distinction between a library and a plugin is somewhat blurred by UE4’s default behaviour of linking plugins in statically as if they were any other module.

Thanks, I understand your approach on this. As you said, it will be embed with your build / cook, but you can avoid it to be loaded. I need to check where to place the manual load for “PreDefault” loading phase ^^.
By the way, the docs is not referring “none” as an option :frowning:

Speaking of whether or not code plugin or module, your choice is determined first by: Do you need public header to use in your code? It is highly not recommended for plug-in. It’s a question of best practices more than technical.

On the Performance point of view, I still don’t know if they are any discrepancies as at the end you still have a statically link library. The only benefits I’m seing in module is that you can avoid to build it for certain configuration and avoid a “extra” loading of a library.

Thanks all for your feedback, this thread is really useful.