Custom Importers

Hi,

I’m trying to figure out how to import files that are not supported by the standard importers. I like the reimport-on-modify feature, so I assume I’ll be using the AssetPostprocessor. My question is: is there any way to override the FBXImporter normally used for models and roll my own?

For instance, I am attempting to import a rigged model using a combination of a .obj and .bvh file. The fbx importer insists on splitting it into meshes based on groups, but the groups are used to denote the bone the vertices are attached to, not separate meshes. I’d also like to import .raw files as terrains. Does the PostProcessAllAssets(?) function include unknown file types in its arrays?

Thanks.

wow, 50 views and not a single reply. This must be harder than I thought.

Another example might help. The FBXImporter’s support for collada is weak. I’d like too find a way to use feeling software’s FCollada to import collada files.

As I understand it, Unity uses the Autodesk FBX SDK. There is now an extension SDK for it. Does Unity load FBX extensions from anywhere? If so, where?

Thanks.

Hi
This topic interests me as well, as i want to use custom format.
Let me know if you find any clues
++, Mike

Hi Progor,

Yes, this is a tricky question :slight_smile:

The answer is: no, there is no proper way to write your own asset importer in Unity at the moment.

I can’t remember that (because as I said, there is no official support). The easiest thing way to figure out - test it yourself :wink:

I asked guys here in the office, so the ideas we have at the moment:

  1. nice and simple: “custom assets” can be imported as TextAsset, as long as you can fix your asset into text format :wink:

  2. ugly and theoretical (we haven’t tried that in practice and we’re just guessing that there is enough API exposed for doing that):

The idea is to load your file in editor and generate regular asset (for example mesh), save it, so it can be loaded in game. The steps would be something like that:
a) You can use regular System.IO functions in editor, so you can load your binary files (but you can’t in web players, ihpone, and so on, because data is packed)
b) In PostProcessAllAssets you could load you file, and generate proper asset (for example a Mesh)
c) Save generated mesh
d) Use generated mesh in game

As I said this all is theory - we haven’t tried this in practice :slight_smile:

I would always recommend submitting a bug if you thing that something doesn’t work as expected. If the problem is not on our side we submit bugs to Autodesk (or MAXON, or any other 3rd parties). We have close relationships with these companies. For example Autodesk usually fixes bugs in 1-2 release iterations. We have just two collada issues open at the moment and they both are fixed in latest FBX SDK (we will upgrade to it before Unity 3.0).
I tend to repeat this: we can’t fix bugs that we are not aware of :wink:

And Autodesk put a lot of effort into improving Collada support, so it might be that in 3.0 you won’t see the problems you see now.

No, Unity doesn’t load extensions.