skip to Main Content

Creating Custom Editor Assets

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.

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:

This Post Has 11 Comments

  1. This is really helpful, I just wish there was information on creating editor menus as I can’t seem to get past this part to actually making a functional asset instead of something that just stores data.

  2. Assertion failed: Child->IsChildOf(Parent) [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 3037] NewObject called with invalid class, DGRGAnimationSetAssetFactory must be a child of DGRGAnimationSetAsset

  3. Thank you for the quick summary, I was missing this line:

    FSlateStyleRegistry::RegisterSlateStyle(*StyleSet);

    …and you set me straight!

  4. Hi,
    Is there a reason why same code works for project based on pre-builded engine install, and
    don’t work at all on my own builded engine from source code? Both cases: 4.24

    1. Hello,

      I’m afraid I haven’t tested this out. Usually when something doesn’t work in a different build it’s enclosed in various build configurations that do not apply in 2 different cases, however I may be wrong on this one.
      -Orfeas

  5. Having attempted to do this all via a Plugins’ source folder than a Projects I cannot see the additional context menu item for my custom item.

  6. Not sure if it’s a 4.26 thing, but I had to add “UnrealEd” to my private dependency modules to get this to compile…

    1. Also, like George above I suspect, my custom category isn’t showing up in the blueprint menu section…

      1. you need this in your StartupModule

        IAssetTools& AssetTools = FModuleManager::LoadModuleChecked(“AssetTools”).Get();
        DialogueAssetCategory = AssetTools.RegisterAdvancedAssetCategory(FName(TEXT(“Water”)), LOCTEXT(“DialogueAssetCategory”, “Water”));

        The ‘Water’ plugin has all the new stuff

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back To Top