- Home /
How do I mark an asset as processed in AssetPostprocessor class
Hi there,
I'm currently writing a custom importer for a text based file format. The importer creates a prefab and some mesh and material assets. My construction consists out of two AssetPostprocessor classes. The first I'm using to read data and do some conversion of the format I'm using, the first one creates an empty prefab and a working GameObject (which I later try to replace the prefab with). The second AssetPostprocessor class handles the prefab and should create material and mesh assets out of the temporary data stored inside the gameobject.
I'm using the OnPostprocessAllAssets method and receive the first asset path from the "importedAssets" array to work with. Running this import with one file into a specific folder works fine. For some reason the array contains more than two asset pathes when I'm running the import again with a different file in the same folder.
My Debug outputs show that Unity does some AssetDatabase.CopyAsset calls on the background (on the last created prefab, which are not related to my code (I'm not even using CopyAsset)). As i doubt that i may intersect these actions in any way directly I was wondering if there is a way to mark the assets listed in the parameter arrays as "processed" so the won't be in the array on the next call.
If there is no way to do so, I would be glad if someone can provide an explanation on what unity might be doing with the arrays and how they get filled (perhabs cleared after some time) or even if there is a possibility to get this list of asset paths from some other class do directly manipulate it.
Thanks in advance Tobias