Creating a Content Browser Asset in UE4

Sometimes when working in UE4, you might want to create instances of your object in the Content Browser as assets that can be saved out to disk, or have custom editors associated with them. For instance, having your own asset type allows you to create a custom editor UI for it. Editors built into the engine include things such as Blueprint Editor, SoundCue Editor, etc. The process to do this is actually quite simple! All you need to do is create a Factory for your object.

I’ve started by creating a simple class called MyObject – the header and CPP files are below

Once you have your object created, the next step is to create the Factory class. This class is only usable if you are including the UnrealEd module in your Build.cs file to the PublicDependencyModuleNames array. The Factory class is quite straightforward:

After that comes the implementation of the Factory itself. I’ll paste the code and highlight the two lines of importance

If you look through this code, we have two important lines

SupportedClass = UMyObject::StaticClass(); is the object that we want to create. If you have your own object then replace the UMyObject with that.

UMyObject* MyObjectAsset = ConstructObject(Class, InParent, Name, Flags | RF_Transactional); is the line that actually constructs the object. You’ll notice that the type of the variable as well as the templated call to ConstructObject. Once again, if you have your own object, then replace these with your class name.

Once you compile these and launch the editor, simply right-click in the Content browser and under Miscellaneous, you’ll be able to create your object



Once you create the asset, you’ll see it in the content browser like any other asset built into the engine



Finally, if you double click on the object you’ll get a standard editor where you’re able to edit the properties of the object


You can check out Factory.h for other ways to customize the factory. I’ll touch on some of those in a later blog post.

Its important to note that even though you can now edit the properties of the object once you open it (or start implementing your own editor), you need to configure your object to serialize that data out. That is a whole new post as well, another one that I’ll cover in the future. If you want to look into it yourself, check out the Serialize function in other asset types.

Leave a Reply