Hey folks. I’m trying to get a set of about 18 different sprite sheets (128x128, with 9 sprites of 32x32 each per sheet) working as flipbook animations with the Sprite Resolver. I’m using Unity 2021.3.16f1 LTS on Windows 10. These sprites are taken from Phantasy Star 3 from the Genesis, which I’m using as a test until I understand this system. Being able to swap out animated sprites is a KEY feature of the game design that I’m working to.
At present, I have 7/18 Sprite Libraries that refuse to display a sprite when entered into the Sprite Library Asset of the Sprite Library component on the Game Object (and with testing of the Animator component in Preview mode). As far as I can tell within the inspector, these libraries that don’t work are identical to the sprite libraries that do, different sprites aside.
Has anybody had this problem before? Is there anybody here who has experience with the resolver? Any chance I could show someone the problem I’m having via Discord? There seems to be quite scant documentation, and looking at the provided samples I can’t see what I’m doing wrong with the sprites that don’t display. This is driving me up the wall, and I’d love to get into production with these tools.
…As it happens, the problem wasn’t to do with the Resolver. Instead, I needed to put the Sprite Renderers that would display the sprites on a higher level than the background. Like I said above, 7/18 of the libraries wouldn’t show above the surface, but the rest did, so I thought it was something I was doing with the Sprite Library setup. Only spotted the solution when I happened to put the scene view into 3D mode. Frustrating, but I guess that’s a lesson learned… =/
Thanks for sharing, @Reverend-Speed ! That’s correct, you would still need the Sprite Renderer. The Sprite Renderer looks to the Sprite Library and Sprite Resolver to decide which which Category and Label to resolve to.
It’s also great that you played with our 2D Animation samples too! Did you know that we have also released our new e-book, 2D game art, animation, and lighting for artists, which is now available to download for free. This is our most comprehensive 2D development guide yet, created by the team behind the demo Dragon Crashers, with contributions from other Unity 2D experts.
You could refer to pages 65-70 on Sprite Swap and Skins. (Bonus if you are using the LTS version as the workflows detailed in this e-book are tailored for the latest LTS version.)
Also, as we have been improving our Sprite Swap workflow progressively over a few releases now, our Sprite Swap documentations would be a good place to check out too as they contain the most updated information for every version eg. 22.1, 22.2 etc.
Hi @suxiangting ! Well, as stated in my posts above, the issue was not that I wasn’t using the Sprite Renderer, it was that I wasn’t using the sorting order / layers correctly, which resulted in inconsistent visual behaviour and a difficult-to-diagnose problem! =) However, hopefully I won’t encounter that problem again going forward…!
The 2D Animation samples were great (though they didn’t help me realise the problem was sorting). I’ve also downloaded and enjoyed the 2D Game Art, Animation and Lighting For Artists e-book - I think I understand flow maps better after reading it, which is great!
For people who are working exclusively with Flip Book sprites, as opposed to 2D skeletal animation, I would recommend looking at this tutorial rather than pages 65-70 of the aformentioned book, as this mainly considers Sprite Swaps in the context of 2D skeletal animation, and could be a little confusing (and seeming a little off-topic, if you just want to flip through animated frames).
Again, the documentation you’ve linked contains some useful information, however it’s presented in the context of 2D skeletal animation, which can make discerning the absolutely relevant elements a little tricky - as before, I recommend the tutorial linked above for a clear discussion of the process of using Sprite Libraries and the Sprite Resolver in the context of 2D flipbook animation.
(…though none of it ended up helping me find the sorting issue in the end… =/ /grumble)
Also, the 2D Animation Swapping Sprites in Unity is a great tutorial! Thanks for sharing! Fun fact: the reason why so many of our samples and tutorials are geared towards skeletal examples is because the Sprite Library was designed primarily for skeletal animation use cases. That’s not to say we cannot use the it for Flipbook. It’s still possible.
Also, good news! Regarding the hash bug mentioned in the tutorial, this has been fixed in 22.1.
So there’s no need for step 6 if you are on Editor version 22.1 onwards. However, if you were previously on older versions but later upgraded to 22.1 or later, the animation clips don’t get upgraded automatically. But fret not! Because we have the 2D Animation Asset Upgrader which helps you upgrade and fix the older animation clips easily.
Thank you also for the helpful thread! Hopefully this helps some other users notice the Sorting Layer/Order in Layer earlier.
I appreciate that the documentation was built to support the workflow the tools were primarily intended for. However, there’s… there’s a LOT of Unity games using flipbook animation, especially games with pixel art. Given how useful these tools are for so many developers making so many games, perhaps it would be useful to re-gear the docs to make them equally approachable for said developers, or perhaps to provide a guide to the alternate workflow as linked above? (Also, I think the Sorting Layer / Order thing is mostly my fault, but it might be useful to add a reference to this in said reworked guide?)
Delighted to hear about the hash bug issue being resolved!
I was wondering - would it be possible to make the Sprite Library keys in the Animator work in a similar way to when using Sprite Sheets, ie. to place a thumbnail of the specific sprite for the key into the Animator window? This would certainly make key choice/placement a clearer and more straightforward process instead of continually having to check between multiple panes/components while placing.
Thank you for telling me about the 2D Animation Asset Upgrader - that’s an extremely useful feature from Unity!
Thanks Rev! This is true too. Let me bring this feedback to the team for future doc considerations.
Yes, this is something we’ve been thinking for a while now. We are big on this and it is definitely one of the quality of life improvements we would like to consider.
Thanks for all your feedback too! Let me add them to our ProductBoard for easier reference and consideration.