Skip to main content

Tech Art Bits: Extending Unreal Editor with custom menus (with Python): the Level Editor Toolbar

One of the most common problems tech artists are in need of solving is that of delivery; how do we get our tools into users' hands?


There are various answers to this question, and each use case demands a different implementation: for asset-centric tools, a context menu in a content browser tends to work best. For more generic tools, some kind of launcher is generally preferred.

In my day job, I work with Unreal Engine, and this is a question I run into a lot, and one I've had to solve a few times. I recently started getting more stuck into this problem however, and I thought I would share what I learned. I should add that I received some assistance in this from friends at Epic Games and the Technical Art Community, who were kind enough to ask around internally at Epic for the solution to the final bit I was stuck on.

So let's dive straight into the code, as that's what you're probably here for. Note that all code in this post has been tested on Unreal Engine 5, but should work in Unreal Engine 4.27.

Adding a custom button menu to the Level Editor Toolbar

This is a great snippet you can use to add your own set of tools in a nicely collapsed combo button to the level editor toolbar; this helps keep your toolbar neat, while giving you an extendable place to server users with lots of entry points to your various tools.
Alright, this is pretty cool, but the button doesn't actually do anything when pressed, and at present, it has no options in its dropdown. We can resolve this by adding the following bit of code:
Much better! With these two snippets, we can now create custom toolbar buttons that serve a menu dropdown list, which make for a great way to serve up tools to your developers. Enjoy!

Comments