SuperTiled2Unity
SuperTiled2Unity copied to clipboard
Calling custom TMX importer directly
I create .tmx files within Unity, as well as the .png tilesheets. The problem is that because the tilesheets are marked as dependencies, the custom importer is fired for each tilesheet change. So if I have 10-35 tilesheets being created, the custom importer is unnecessarily fired 10-35 times. In reality, I only need it to be called once.
I call File.WriteAllBytes for every .png file, but I don't call AssetDatabase.SaveAssets and AssetDatabase.Refresh until the very end.
Is there functionality, or the ability to extend SuperTiled2Unity (locally, for now) to call a custom TMX importer of a specific type?
I somewhat solved this issue by:
- Deleting the
.tmxfile viaFile.Delete, before I recreate it - After creating, call
AssetDatabase.ImportAsseton the.tmxfile
This solves the issue, but it's an ugly solution. The other issue is that there's an object count of 2 for the .tmx file, which I don't understand. This has the custom importer executed twice. I'm not sure why. If I delete the .prefab I generate, then the importer is called just once.
There was another issue in the past few days where Unity would lock up for 30-50 seconds at a time. There was 100% disk activity, and a ton of asset files were being read. This was killing my productivity (and patience).
I profiled the editor and found SuperAssetDependencyPostprocessor.cs and TiledAssetDependencies.cs to be culprit.
I force removed the files, and adjusted TmxAssetImporterEditor.cs to reflect the change.
I'm seeing that separating out the logic from SuperImporter would be a huge task, as it's directly coupled with Unity's importing pipeline.
I guess that's a project for another day.
Hi there, @ijacquez. Are your tilesheets being automatically generated by some script?
Yes, it's a script that generates these .tmx files.
I'm no longer working on the project, but the workaround that I mentioned did work.