Unreal Engine supports creating custom thumbnails for any asset type. This includes custom blueprint types, custom data assets, etc.
This can be very useful for visualizing especially what kind of content data assets have, since they don’t have any useful thumbnail by default.
Note that thumbnail renderers should be within an Editor Module.
Steps to add custom thumbnails
- Create a custom UThumbnailRenderer
- Register your thumbnail renderer with UThumbnailManager
Create a custom UThumbnailRenderer
To create a thumbnail renderer, you can inherit from UThumbnailRenderer or any of its child classes. UDefaultSizedThumbnailRenderer is a good choice.
You only need to override the Draw
function on your class.
UCLASS()
class MYEDITOR_API UMyThumbnailRenderer : public UDefaultSizedThumbnailRenderer
{
GENERATED_BODY()
public:
virtual void Draw(UObject* Object, int32 X, int32 Y, uint32 Width, uint32 Height, FRenderTarget*, FCanvas* Canvas, bool bAdditionalViewFamily) override;
};
For reference on how to use it, you can refer to the engine’s builtin thumbnail renderers.
Register a thumbnail renderer
Once you have created the renderer class, register it with the thumbnail manager:
UThumbnailManager::Get().RegisterCustomRenderer(UMyAsset::StaticClass(), UMyThumbnailRenderer::StaticClass());
This logic seems to require running on/after PostEngineInit. You can use either FCoreDelegates
, or if your module’s loading phase is PostEngineInit
you can just run it from StartupModule