Create an engine plugin using BlankPlugin

Prerequisites :

The development of a new plugin, using the “4.16/engine” Directory isn’t the best way to go at start,if i can’t to compile well, other project stored into the launcher library that use this engine version will no longer start, because of the compile errors.

The best practice is to create a new project, to configure the plugin and make bring it to compile code successfully, before to move it onto the engine directory of your version of Unreal Engine.

  • Create a new c++ blank project from the project browser. ( note -–> it will built the solution and launch in UE4.)

It’s necessary to have generated a solution file for your project before you can compile a plugin for your project.

  • go at the root of your project.
  • Do a right click on the *.Uproject file then Generate Visual Studio project file.

2015-10-30_18-22-35

 

 

  • Now we need to create a plugins directory into “project_name\Plugins“.
  • Copy the blankplugin from “4.9\Engine\Plugins\Developer” to “project_name\Plugins\Developer\MyPlugin
  • Rename”blankplugin.uplugin” to “myPlugin.uplugin
  • Open the file in notepad and then edit like below.
  • Go back at the root of your project, and then Delete the Binaries and Intermediate directories.

Files Renaming

Open the “MyProject/Source” directory , and rename all the .cpp, .h and .cs files like listed below :

Engine\Plugins\Developer\BlankPlugin\BlankPlugin.uplugin >> Plugins/Developer/MyPlugin/MyPlugin.uplugin
Engine\Plugins\Developer\BlankPlugin\Source\BlankPlugin\BlankPlugin.Build.cs >> Plugins/Developer/MyPlugin/MyPlugin.Build.cs
Engine\Plugins\Developer\BlankPlugin\Source\BlankPlugin\PrivateBlankPlugin.cpp >> Plugins/Developer/MyPlugin/Private/MyPlugin.cpp
Engine\Plugins\Developer\BlankPlugin\Source\BlankPlugin\PrivateBlankPluginPrivatePCH.h >> Plugins/Developer/MyPlugin/Private/MyPluginPrivatePCH.h
Engine\Plugins\Developer\BlankPlugin\Source\BlankPlugin\Public IBlankPlugin.h >> Plugins/Developer/MyPlugin/Public/IMyPlugin.h

Open them all with a text editor (notepad or notepad++) and then just remove all the references to “BlankPlugin”

Example : I had renamed “MyPlugin” for the purpose of this mini tutorial.

When it’s done, go at the root of your project, then

  1. delete the sln, suo files
  2. right click and generate solution file.

Recompile the project

You can create a batch file at the root of the project, so you can rebuild the plugin just by executing the batch instead of running Visual Studio.

(just edit the path accordingly to your drive and paths)

Copy that into a new txt file, and rename to build_plugin.bat

Deploy the plugin as Engine Plugin

The plugin should compile fine, but it’s a game plugin, because the plugin is hosted into the Game Project.

If you want to share the plugin at the engine level,

  1. You just need to copy the directory “MyProject/Plugins/developer/MyPlugin/” to “4.9\Engine\Plugins\Developer/MyPlugin/ “.
  2. Delete the Binaries and Intermediates directory,
  3. Launch UE4, it should recompile the plugin before the editor loads
  4. If everything is proper, now the plugin should be displayed into the plugin manager into the “built -in > examples” section.

 

Nicolas Kirsch

Updated : 06 Nov 2015