I am attempting to create an asset importer that will read in a custom file format and have Unity recognise it, parse it, and place it in the asset database. I have chased my tail on this problem for the better part of two weeks trying to find the right combination of function calls and classes to make this work. I have investigated AssetPostprocessor, AssetImporter and read everything I could find on the forums, Unity answers, and every published book concerning Unity on how to do this particular task and nowhere is the process documented. The documentation of creating a custom asset importer and having Unity invoke it when an asset of that format is brought in to the Unity editor is obtuse and poorly detailed.
I've asked on the forums (in two different ways), I've asked on Unity answers, and I have yet to see any response that addresses the problem.
In all the years that Unity has existed I find it unbelievable that nobody (at least, nobody that reads the forums) has ever needed to import their own asset formats.
Can someone from Unity Technology actually answer this question or direct me to a resource that solves it?
I need to do this too. Anybody?
There is no proper way to do this, i.e. Unity doesn't expose convenient way to perform this.
I would say there are two parts:
1) Import your custom file into Unity
2) Trigger file import when file changes
First part can be done by just writing some scripts, which open your file, parse it and create necessary prefabs/meshes/texture/hierarchies in Unity project.
The second part is automating this process. I think the only way to do it is using AssetPostprocessor.OnImportAllAssets (or something like that). In that method you would have to check if any of your custom files have changed and then trigger reimport based on that.
@pauliusliekis | Ex Unity developer
http://pixel-punch.com | Development of Unity, Augmented Reality and general 3D projects
Thanks for the clarification. It is as I suspected. My solution at this time is to have separate asset processors that export to a recognised format that Unity is aware of or a custom binary format that I can interpret inside of Unity by reading the bytes directly from a "TextAsset."