Editor plugins in UE4 #1 – Intro
Recently I started working on some plugins. It’s mainly some editor extensions for better workflow. When I started to read up on the topic of extending editor I found out, that there really isn’t that much of documentation or tutorials on this topic. And those few tutorials are quite dated (though still useful). So basically the only way how to learn how to make an editor plugin was to dig through the source code and learn from it. This is obviously very tedious and time-consuming process. So I decided, that I’ll document all the stuff I learn in the form of short tutorials. In this tutorial, I am going to show you how to create an empty plugin and what it is made of.
There are basically two ways how to create a plugin. You can create it manually or use plugin wizard. I recommend using plugin wizard. It will create the folder structure and add all the necessary files. You can find it inside plugin browser (Edit/Plugins). There is a green button in the bottom right corner, that says New Plugin. The plugin wizard will allow you to choose from several presets. These are just templates with some example code. You want to create an Empty plugin. Give it a name and create it. After it is created, you will need to restart the editor.
Inside Visual Studio, you can see a new folder called Plugins. Inside you’ll find a folder with your plugin. It’ll contain Resources folder, Source folder, and .uplugin file. The .uplugin file (or plugin descriptor), contains the description of your plugin. You can read up on it here . Most of the properties are optional. However there is one, that is very important and that is “Modules”. Here you will add all the modules, that the plugin is created of. You will also assign to the individual modules a type (Runtime, RuntimeNoComandlet, Developer, Editor, EditorNoComandlet, Program) and you can also set the LoadingPhase and Whitelist/Blacklist platforms (more on that in another tutorial).
{ "FileVersion": 3, "Version": 1, "VersionName": "1.0", "FriendlyName": "TutorialPluginEditor", "Description": "", "Category": "Other", "CreatedBy": "", "CreatedByURL": "", "DocsURL": "", "MarketplaceURL": "", "SupportURL": "", "CanContainContent": true, "IsBetaVersion": false, "Installed": false, "Modules": [ { "Name": "TutorialPluginEditor", "Type": "Developer", "LoadingPhase": "Default" } ] }
Inside Source folder, you’ll find all modules, that make the plugin. In your case, there will be only one folder (module) with the same name as your plugin. However, your plugin can be made of many modules. For example, Paper2D consist of several modules.
Each module will be in a separate folder and will have its own .Build.cs file. In this file, you’ll add all the extra modules used in the plugin.
using UnrealBuildTool; public class TutorialPluginEditor : ModuleRules { public TutorialPluginEditor(TargetInfo Target) { PublicIncludePaths.AddRange( new string[] { "TutorialPluginEditor/Public" // ... add public include paths required here ... } ); PrivateIncludePaths.AddRange( new string[] { "TutorialPluginEditor/Private", // ... add other private include paths required here ... } ); PublicDependencyModuleNames.AddRange( new string[] { "Core", // ... add other public dependencies that you statically link with here ... } ); PrivateDependencyModuleNames.AddRange( new string[] { "CoreUObject", "Engine", "Slate", "SlateCore", // ... add private dependencies that you statically link with here ... } ); DynamicallyLoadedModuleNames.AddRange( new string[] { // ... add any modules that your module loads dynamically here ... } ); } }
And that’s it. I said it will be series of short tutorials, so I’m not going to go too in depth just yet.
Leave a Reply