Why does my custom file format files get bigger in build?

Hello guys,

We’re working on an animation viewer kind of app. Because we have to display 1000s of animations and load them at runtime, we have developed our own proprietary ultra compressed file format making each animation weight around 40KB. I wrote a custom importer for the files to use Unity’s animation engine natively and everything works fine.
However after building the app and looking at the Editor.log I see that my animations now weigh upwards of 2MB.
As an example in editor.log :
1.2 mb 0.1% Assets/Resources/Anims/RO1_X0036.Mot6.mcla
This file weighs 66KB on my hard drive.

What creates this difference? Is it the importer that for some inexplicable reason rewrites all animation files?
How can I keep this very small file size?

I wrote a custom importer for the
files to use Unity’s animation engine
natively and everything works fine.

Well, how does this importer work? Do you “import” that files at runtime? If not of course the files will be larger since you stored the result most likely as AnimationClip. Unity doesn’t include any of the source files in a build unless it is a file in the streaming assets folder. All imported files (imported inside the editor) are stored in the resulting asset format. The Unity editor has countless of importers for various datatypes, the Unity engine has not. At runtime you can not import or load model or animation files. Even when it comes to images Unity only supports loading jpg and png.

So to me it’s not really clear what happens here. Your file extension seems to be “mcla” which Unity does not import by default. So when you wrote an editor script / custom asset importer for that type, of course your importer will actually create an AnimationClip which is what is actually stored in the asset database and is what is actually shipped with your game.

If you want to ship your custom file with your game you have to load your animations in a runtime script and ship your file either as textasset inside your assetdatabase, or put it into the streaming assets folder and load it manually.

If you need further help you have to be more specific about your “importer”.

Thanks for the reply, that makes sense.
The importer script creates AnimationClips yeah so that’s what the engine must be saving.

I’ll have a look at streaming assets or find another solution thank you.