Editor plugins in UE4 2# – A few tips
There are few tips I’d like to share with you before you start coding. Some of them are obvious, some a bit less, but I thought it’s worth mentioning.
UI extension points
If you are going to extend the editor, you will need to know where to place the button/menu/widget. For that reason, UE4 uses extension points (Extension hooks). They serve as a way to identify a certain place in UI. There is a way to display them, so you can easily find out, where to place your custom UI. Go to Edit/Editor Preferences and under General/Miscellaneous check Display UIExtension Points.
You will see the effect on newly created menus, but I recommend restarting editor, so it takes effect across the whole editor. The extension points will be displayed in green text.
If you need to know, how certain UI element (menu, window, button) was created, you can use Widget Reflector. You can find it in Window/Developer Tools/ Widget Reflector. The easiest way to use it is to click on Pick Live Widget. This will allow you to pick a widget by simply hovering over it. You can end picking by pressing ESC key. In the Widget reflector, you will be able to see all the layers, that makes selected UI element.
Documentation is your friend. That obviously applies to gameplay programming as well, but in this case, it is even more important. Unlike gameplay programming, there aren’t that many tutorials on plugin development and if you ask a question on Answerhub, chances are, that it will remain unanswered forever. So you will probably have to figure out most of the problems yourself, and documentation is one way to make this process a little bit easier.
There is also one quite important piece of information at every docs page. Right at the bottom of a docs page, you can see the header file, that needs to be included to use a specific class and a module, to which this class belongs. This is important because you need to add this module to your Build.cs file in order to use the header file.
Another way, to learn new thing as far as extending editor goes, is to explore the engine source code. It can be pretty daunting at first, but once you get the hang of it, you can find pretty much anything you can imagine there. Most of the stuff I learned was from exploring the source code and testing my findings inside my plugin code. I thought I’m going to give you few tips, where to find useful info.
A good start would be to check out PluginBrowser plugin. You can find it in Plugins/Editor/PluginBrowser . It has enough elements, that you can learn a lot from it, but it is not too complicated. SFilePathBlock is a good example of a custom widget. It is also nicely commented and you can easily compare the code to the result (it is the path and name part of the plugin wizard).
For more complex stuff, go check out Paper2D. Under Plugins/2D/Paper2D/Paper2DEditor you can find a lot of information. I recommend checking out ContentBrowserExtension and LevelEditorMenuExtensions to see, how they did menu extension in different parts of the editor. You can also check out, how they build whole custom editors for sprites, flipbooks, tilesets, and tilemaps.
Another good resource for learning slate code is in Source/Runtime/AppFramework and then Framework/Testing. Lots of slate code to check out.
Last recommendation from me would be Source/Editor/Kismet and Source/Editor/BlueprintGraph. That’s where BP editor and K2 nodes are. Great stuff, if you want to start messing with BP editor or create custom nodes (K2 nodes will be covered in a future tutorial).