How do I add a custom asset importer?

I have a custom spritesheet/animation format I want to import, and I want to hook my C++ importer (currently a plugin with a button that opens a file dialog and then parses the file, currently just logging stuff out) into the actual import asset dialog. What I’d like to do is have my file type show up in the file filter, have the extension recognized, and the selected file passed into the appropriate UFactory to create the final asset in the content browser. Is there literature going through how to do this sort of thing?

Ok so to answer my own question, from looking at the Paper2D source:

In the UFactory constructor, set bEditorImport and bText to true, and add formats in this way (for instance)

Formats.Add(TEXT("json;GTS JSON file"));

Then override FactoryCreateText and handle your parsing and object creation there. Pretty straightforward.

1 Like

In Unreal Engine 4.12 the method FactoryCreateFile was introduced as a common entry point for both binary and text asset types, falling back to FactoryCreateBinary / FactoryCreateText when no implementation was given for it. The (potential) advantage is that FactoryCreateFile receives a file path, which offers more flexibility.

what if one does not want to modify paper2D ? I dont feel confortable doing so, might become incompatible in future releases