Project Plugins
in Unreal Engine

Plugins have many usecases. In C++ projects, there's 7 types of project plugins. How they vary each other, which one to select to fit the project needs and how to use it?

Plugins in Unreal Engine

Unreal Engine contains various types of plugins. Plugins are reusable components independent of the project - for each project, you can decide whether to enable them or not. Through plugins, you can easily share functionality across multiple projects.

You can explore, activate, and deactivate plugins in a window accessible through the toolbox under the option EditPlugins.

By default, in the "Plugins" window, you can see only the so-called "Built-in" plugins, which are basic components of Unreal Engine. However, you can extend this selection with "unofficial" Project plugins, which you can write yourself or use some downloaded from the internet.

Moving plugins between projects is then very simple - just copy the plugin folder to the "Plugins" folder of your Unreal Project. Nothing more is needed, even if the plugin is of C++ type and your project is not (Blueprint project without C++ compilation). If you don't even want that, you can use a symlink from the folder of the specific project to the folder of the current project.

Working with Plugins in Development and Projects

Assets created as plugins are available within Unreal Engine in the same way as regular project assets - you'll find them in the folder hierarchy under "Plugins" instead of "Content". In terms of work, there isn't much difference, except for the possibilities depending on the specific purpose of the plugin.

So, when should you create C++ classes as project classes and when as part of a plugin? This always depends on the structure of the projects you commonly develop. In principle, any reusable components are better kept in the form of plugins, while project-specific components are assigned to the project.

As for the structure of plugins, it's similar to that of classes. Generally, it's better to work with multiple plugins that differ in the "category" of functions, rather than putting all general functions into a single plugin. In Vrealmatik, for instance, I have separate plugins (= libraries) for general components, specialized components, physics, interactions, etc.

If you're not using a single plugin code source for all projects (using symlinks / shortcuts), it's certainly possible to modify the plugin code for the needs of individual projects. This applies to both class-level plugins and project classes through overridden functions.

Creating a Project Plugin in Unreal Engine

Plugins in Unreal Engine can be created through the Toolbox menu EditPlugins, where in the displayed "Plugins" window, you choose the option + Add.

The newly opened "New Plugin" window offers several predefined Plugin templates.

After choosing a template from the menu and filling in basic information about the plugin (name, author, description), simply click the "Create Plugin" button at the bottom right, and the Unreal Project will be expanded / supplemented with a folder for the plugin located within the "Plugins" folder of the current Unreal project.

Basic plugin configuration

Basic plugin configuration (such as enabling / disabling Content folder through CanContainContent key) + changing plugin metadata (version, author, description...) is possible to do in .uplugin file of the plugin.

Editor Standalone Window Plugin

Adds an button into window list, see the screenshot below.

On pressing that button, a new standalone window is opened. This window can be placed by user anywhere within the engine viewport, such as any other Engine window.

The window content (text) of the standalone window is defined with following code:

TSharedRef FfwtrendEditorStwModule::OnSpawnPluginTab(const FSpawnTabArgs& SpawnTabArgs)
	FText WidgetText = FText::Format(
		LOCTEXT("WindowWidgetText", "Add code to {0} in {1} to override this window's contents"),
	return SNew(SDockTab)
			// Put your tab content here!

Editor Toolbar Button Plugin

Adds an button into a toolbar section, window list or both, see the screenshot below. You can trigger some action on pressing that button(s).

Default message on pressing that button

The content (message) above was generated with the following code:

void FfwtrendEditorTBModule::PluginButtonClicked()
	// Put your "OnButtonClicked" stuff here
	FText DialogText = FText::Format(
							LOCTEXT("PluginButtonDialogText", "Add code to {0} in {1} to override this button's actions"),
	FMessageDialog::Open(EAppMsgType::Ok, DialogText);

Creating a C++ Class for the Plugin

The process of creating a C++ class, which is a part of the plugin, is identical to creating regular classes (Tools → New C++ class). After selecting the type of the class, within the definition window, choose the destination for saving that is related to the plugin instead of the project.

Process of Moving a Plugin from One Project to Another

Files related to the plugin are located in the specific Unreal Engine project folder (in the image below, "VrealmaticLibrary"), within the "Plugins" subfolder. If you navigate to this folder using any file explorer, you will see a list of plugins. In the image above, there's just one plugin named "VrealmaticComponents."

To transfer a plugin to another project, simply copy the plugin folder to the "Plugins" folder of the other project. If the "Plugins" folder doesn't exist in the other project, you can create it. If the plugin is not visible after launching the project, you can try turning off the project and then launching it again by right-clicking and selecting "Generate Visual Studio project files."

Accessing data in the plugin's Content folder

There are 2 ways to access the assets in the plugin's folder. The proper way depends on the function used:

  • Absolute Path - Absolute path to the asset D:/UnrealEngine/MyProject/Plugins/PluginName/Content/Path/To/Asset
  • Relative Path - Relative path to the asset /PluginName/Path/To/Asset