In this post we’re going to create custom editor assets. In order to extend the UE4 Editor and add your own assets you need two classes:

  • One class that contains the various properties of your asset
  • One class (named XFactory where the X stands for the asset’s class name) that constructs the above class as an Editor asset (meaning a .uasset file).

For most assets, their factory classes are inside the EditorFactories files of the Editor. For example, when you’re creating a new Texture inside the Editor you will be presented with the various properties that are written in the Texture.h file. However, the class (named UTexture2DFactoryNew) that constructs this asset in the Editor is contained inside the EditorFactories.

So, let’s create our custom editor assets.

Download the entire source code from my GitHub repo

Creating the Asset class

In order to create a custom class, add a new C++ class (I’ve named my class as OrfeasCustomAsset) that inheirts the Object class and type the following code:

Then, add a new C++ class that inherits the factory class:

and add the following code to its header file:

Let’s type the logic for these function inside our source file:

In order to access the AssetTypeCategories.h file you need to add the “AssetTools” in your project’s public dependencies:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "AssetTools" });

At this point, save and compile your code. Then, restart the Editor and check out the Blueprints category:

Adding a custom thumbnail to your asset

The default thumbnail for your new asset is simply the name of the Asset’s class. In case you want to have a customized thumbnail you need to create a new Slate style and bind it with this asset’s class.

Ideally, you will place your new assets in a new module or plugin. For the sake of this example, I’m going to use a plugin’s startup module in order to create a new slate style for my custom assets. At this point, I’ve added a blank plugin named “OrfeasPlugin” into my project and I’m going to use its default icon as a new thumbnail. Go inside your plugin’s header file and add the following code:

Then, inside your plugin’s source file, add the following code:

In order to access the IPluginManager.h header file you need to add the “Projects” dependency on your plugin’s dependencies:

As a last step, make sure to mark your plugin’s type as Runtime instead of Developer so you can ship your project successfully.

Save and compile your code. Then, restart the Editor.

Here is the end result: