Errors when using Aseprite source file for Tiled tilesets and/or the Unity 2D Aseprite Importer package
As both Unity and Tiled support the usage of Aseprite project files, I was disappointed to discover that SuperTiled2Unity is not currently compatible with .tsx files using an .aseprite file as an asset dependency and/or Unity's own Aseprite package. In my experience, SuperTiled2Unity properly imports the path for the asset, but then fails to find sprites (though does proceed to render invalid sprites when Unity's Aseprite importer is installed).
My naive guess as to what's happening is that SuperTiled2Unity doesn't currently support .aseprite files as a dependency for .tsx files at all, but is still managing to acquire something when Unity's package is installed, as the .aseprite asset will be known by the AssetDatabase.
While supporting this workflow would be reliant on maintaining Tiled and/or Unity's context for Aseprite files, hopefully the motivation to use it seems reasonable given how convenient it is (saving a change in Aseprite will update across both Tiled and Unity without the need for exporting). At the very least, SuperTiled2Unity should probably throw a more descriptive error than "The following texture is missing sprites that are needed for Tiled tilesets (in Super Tiled2Unity)." in this edge-case (clicking the "Add Sprites To "*.aesprite"" button will also result in a crash).
If any consideration could be made for having this setup work, it'd be much appreciated!
Hi there, @meckzqz. I'm just learning about Aseprite support in Tiled now. You're right that at the very least I want better error reporting.
Do I understand that Tiled doesn't actually animate the tiles it gets from Aseprite? That it actually just shows the first frame?
Hi @Seanba, and thanks for the response! Having taken a look, it appears this feature was only added to Tiled about a month ago. I didn't realize it was such a recent addition, so I'm not surprised that you weren't aware of the support.
From what I've tested, it looks like you're correct regarding animation. If I create a tilemap in Aseprite and add a frame with new tiles, they show up in Aseprite's tile palette, but Tiled's support doesn't seem to care and simply presents the first frame.
Thanks for the consideration!
Hi again, @meckzqz. I've looked at Unity support for Aseprite and I see some potential issues but I'm still getting familiar with it.
Do you mind sharing with me a small project where you hope to use *.aseprite files? It might help me from making assumptions.
Sure thing @Seanba, here's a minimal project using Unity 6000.0.39f1, Aseprite v1.3.2, Tiled Version 1.11.2, and Super Tiled2Unity v2.2.5: Aesprite2Tiled.zip
Scenes/SampleScene.unity will have an instance of test_map.tmx with incorrectly rendering tiles, and dependency errors for both the .tmx and .tsx files. The project also uses the latest "Universal 2D" template as a base.
I'll also make a note that the import mode for test_tiles.aseprite has been changed to "Sprite Sheet" as opposed to the default "Animated Sprite" mode for simplicity, but frankly the Unity importer has been a bit of a buggy headache in my experience anyways (and they're also attempting to support Aseprite tilemap layers as an additional import mode in the most recent beta version of the package)! 🙃
Hi again, @meckzqz. I'm getting this warning when I import your test_tiles.aseprite into a Unity project. Have you seen this before?
No Sprites or Texture are generated. Possibly because all layers in file are hidden or failed to generate texture.
UnityEditor.AssetImporters.ScriptedImporter:GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext)
Hey @Seanba, it looks like the file I provided doesn't actually work with version 1.1.8 of Unity's Aseprite importer because of the usage of tilemap layers (I was testing 1.2.1 at the time, and forgot to downgrade). Apologies for wasting your time, and please find attached a version of the file that should import correctly using version 1.1.8 (the version used in the Unity project):
No worries, @meckzqz. I have decided that Aseprite is something I want supported with ST2U and have started this effort. I have to balance time between life and work and I'm still investigating Unity's importer so I don't have an ETA yet but I'll keep you updated.
Awesome, really glad to hear that. Thanks @Seanba!
Hi there, @meckzqz. I've just released version 2.3.0 of Super Tiled2Unity that has Aseprite support built-in. Let me know if you run into any issues.
Hi @Seanba, great to hear! Thanks for the update, and I'll be sure to let you know if I encounter any problems.
Hey @Seanba, I've checked out the new package and the included sample and have a few thoughts to report.
-
It seems that this new support requires the use of the Animated Sprite import mode for aseprite assets, in addition to having an animation clip. I feel this requirement is a bit odd, as the common use case of working with a non-animated tileset isn't currently possible without adding a redundant duplicate frame. Perhaps I don't fully understand what the motivation for this limited support is, or perhaps you have plans for adding support for the other import modes and different usages in the future, so any insight would be appreciated.
-
The importer currently breaks in a couple of cases, presumably due to errant assumptions being made regarding the texture atlas layout. I've been able to produce incorrect results in the following ways:
- By altering the canvas height to be twice as high (and filling the blank canvas space of all frames (in this case with a solid colour), we can see that Tiled has correctly updated the tileset and presents the number tiles as expected. In Unity though, we can see incorrect tile indices being used.
- After adding alpha to the bottom row of number tiles on the first frame, SuperTiled2Unity's importer fails to find sprites on the new atlas produced by Unity's aseprite importer. Adding alpha to all frames results in an import without errors, but with incorrect results regarding tile indices.
- By using the "Tilemap Layer" feature in aseprite (to test this yourself, right click "Layer 1" and then "Convert To>Tilemap"), Unity atlases each unique tile individually as opposed to treating each frame as a sprite. As seen in the screenshot, Tiled handles this no sweat, but SuperTiled2Unity encounters a similar error to the previous case, presumably due to the layout of the atlas once again being more exotic. This feature is especially useful for the sake of animated tilesets, as it avoids redundant tiles being stored in the atlas, and it would be great to see it supported.
That's all I've encountered so far, and while these issues are unfortunately dealbreakers for my own use cases, it's still great to see this support being taken on! Thanks again for the update, and looking forward to seeing some of these issues hopefully being resolved in the future.
Thanks, @meckzqz. Let me absorb all this and figure out what to do about it. For the time being I'm re-opening this issue.
- It seems that this new support requires the use of the Animated Sprite import mode for aseprite assets, in addition to having an animation clip. I feel this requirement is a bit odd, as the common use case of working with a non-animated tileset isn't currently possible without adding a redundant duplicate frame. Perhaps I don't fully understand what the motivation for this limited support is, or perhaps you have plans for adding support for the other import modes and different usages in the future, so any insight would be appreciated.
@meckzqz I assumed Aseprite files would only ever be used for animated tiles but I can see now that someone might elect to use Aseprite as their sprite/tile editor of choice, for both animated and static tiles. I have a fix submitted for this that will part of the next release.
I'll check out the other issues soon. I'll let you know if I need some clarification on those. Thanks.
@meckzqz What version of Unity and the Aseprite Importer package are you using to test the Tilemap Layer functionality?
Hey @Seanba, so I'm using Unity 6000.1.0f1 and Aseprite Importer package 1.2.4 in the previous screenshots.
Just to be clear, I was using the Animated Sprite import mode in Unity and a Tilemap Layer in Aseprite (figured it'd be worth mentioning since the Aseprite Importer package has a "Tile Set" import mode too, which is only responsible for making Unity Tilemap assets). Hope this helps!
Thanks for pointing me to Unity 6.1, @meckzqz.
It looks like Unity's Aseprite importer isn't exporting good animation data when using tilemap layers in Aseprite. There are no animation curves so I don't currently have a way to know how the tiles should be animated. I'm going to have to think about this one.
Just wanted to say that SuperTiled2Unity 2.4.0 has solved all of the edge cases I've encountered on this issue, and feel that we can finally close it. Excellent work @Seanba, thanks again!