2D Animation 8.0 released for Unity 2022.1

2D Animation 8.0 released for Unity 2022.1


We are happy to announce that 2D Animation 8.0 is now available with Unity 2022.1. The focus of this version has been around improving the Sprite Swap feature by making it easier to use and more integrated in the general editor experience.

What’s new?

  • Sprite Swap improvements

  • Streamlined Sprite Swap key framing

  • Animation quality-of-life improvements

  • Introduced Character Pivot tool in the Skinning Editor

  • Introduced an asset upgrading tool, to upgrade older Sprite Library Assets and Animation Clips to the latest version

  • Animation preview window now displays previews of Sprite deformation, Sprite Swaps and IK Solvers.

See the full changelog here.

About 2D Animation
The 2D Animation package adds tooling for rigging a sprite for skeletal animation. It includes a Skinning Editor module in the Sprite Editor window for creating and editing bones, manual & automatic mesh tessellation as well as skin weights generation and painting. The Sprite Skin runtime component ties this all together to drive sprite deformation.
This also includes support for Multi-Sprite Character rigging workflows through 2D PSD Importer Package.

Getting Started

  • Install the latest Unity 2022.1
  • Start a new project with the 2D or 2D URP Template to install the latest major versions for 2D packages in 2022.1.

Optional Performance Boost
When animating your characters, you can improve the performance of the animated Sprite’s deformation at runtime by installing both the Burst and Collections package from the Package Manager. You can read more about this here.

What can you do?
Try it out and let us know what you think of the package. We want to know what works as expected, what doesn’t and what is missing.
And of course we want to know what you’re making with this package. Show us your creations!

1 Like

API updates
In 2D Animation 8, we have cleaned up the public API of 2D Animation and moved a few of its methods into the internal scope. Here is an overview of the affected APIs:

Moved from public to internal
Namespace: Unity.U2D.Animation.Sample
Unity.U2D.Animation.Sample.LoadSwapDLC
Unity.U2D.Animation.Sample.RuntimeSwap
Unity.U2D.Animation.Sample.SwapFullSkin
Unity.U2D.Animation.Sample.SwapOptionData
Unity.U2D.Animation.Sample.SwapPart

Namespace: UnityEditor.U2D.IK
UnityEditor.U2D.IK.CCDSolver2DEditor
UnityEditor.U2D.IK.FabrikSolver2DEditor
UnityEditor.U2D.IK.LimbSolver2DEditor

Namespace: UnityEngine.U2D.Animation
UnityEngine.U2D.Animation.PositionVertex
UnityEngine.U2D.Animation.PositionTangentVertex

Turned into an abstract class
Namespace: UnityEditor.U2D.IK
UnityEditor.U2D.IK.Solver2DEditor

For sprite swapping, in the basic cases, where you have a number of ‘states’ set up like idle/walk/run etc in the sprite library, and are using the resolver to swap between them … I find that the whole idea of creating an animation clip for every little animation a total overkill and too many steps. In many cases all I want is simply for the animation frames to cycle through the labels within the category, e.g. to just loop through several frames of animation while ‘walking’ or whatever. There should be some kind of basic frame-swapping code built-in that doesn’t even use animation clips, where you can just set a) the desired framerate in fps and b) whether to play automatically perhaps. Once I’ve setup the library with its states, it should then be just a matter of flipping a switch to animate the thing. As soon as I use the resolver to swap states, the new animation should immediately just play. I shouldn’t have to be spending time saving off multiple animation clips when all they basically do is just move through the animation frames.

Thanks for the idea, @imaginaryhuman_1 . Are you visualizing this as an API only feature, or a mix of editor + API calls?
Also, could you let us know the reason for why you are using Sprite Libraries for your flipbook animations in the first place?

I’ll note this down as a feature request, so we have it captured for future consideration.

I’m talking about wisywyg editing mainly, though api in the background for those who want to go that route. I’d like to not have to get into code or extra gubbins just to do the most basic of things.

I thought the whole purpose of the sprite libraries was to organize sprite animations per states, like an idle animation, a walking animation etc, little sequences of sprite “frames”, and that the resolver is there to switch between them. Right? That seems to be what the documentation is saying unless I’m misunderstanding it.

So I thought what I’m supposed to do is, bring in my sprite animations, set up the ‘states’ and group the sprite ‘frames’ into the states, and then switch between them as I change the state the sprite is in. Whether that be through script or visual script or whatever. Whatever is the current resolved library category/sequence should just play through its frames without having to really do much besides setting a framerate. I don’t want to have to go create separate animation clips and save filenames and all that just to set that up.

Great, thanks for diving into it a bit.

Sprite Swap was originally created in order to help swap clothing/expressions on a deformed 2d character. The system could then inadvertently be used for flipbook animations, which we leaned into for a few versions. However, the more we look at Sprite Swap and flipbook animations, the more we notice that they do not align very well. So we are actively looking into ways to improve flipbook animations with one of the goals being, simple things should be simple.

If you have more ideas on how we could make flipbook animations easier to create and work with, do throw them at us, we are eager to hear your ideas!

Well in terms of animation as in motion, i would really like to see a spline in the scene view representing the ACTUAL movement path of an object in, aligned with the animation clip, and being able to edit that path in terms of positions/rotations in the scene view and have it automatically update the animation curves. Because working with “split out” x y z animation curves is totally awful in terms of intuitive visualization of where the object is actually going to go. Like, if you want to move in the x axis, you actually have to drag spline handles UP AND DOWN, which is so unnatural. And you have no clue where the object is actually going on-screen because there’s no way to visualize the total spline over time. I see how anim clips are designed to allow all manner of parameters to be animated in parallel but when it comes to basic “i want my sprite to move like this along this path” it’s really not right or easy. I should be able to just ‘draw’ freehand a spline in the scene and have the object follow it or whatever.

In terms of what you are calling flip book animation, ie moving between a series of predefined frames and looping that around while you remain in a give ‘state’ of a state machine, you already have the sprite library and resolver which is what I thought you were aiming for. The only part that’s sort of missing is entering a framerate and auto-play toggle or whatever. Click one button and it works. What else is there to do?

I think unity has the functionality to drag some ‘sprite sequence’ into the scene view and then it asks you to save an animation clip and then it auto-animates it, although at what FPS I have no idea. But that’s not really set up with any kind of state machine scenario. No good for anything but some background animation element.

1 Like

When creating frame-by-frame animation, I feel like the sprite swap system was poorly thought out. The moment you need more than some small changes, like changing from character A to character B you hit a wall.

What if you want to allow full character customization? Female, male, hair, eyes, and clothes animations.
Doing all of this using a single sprite library and a resolver is extremely hard (feels impossible atm) for no reason.
The best solution I found so far is to create multiple libraries, one for each “body part.”

In addition, as imaginayhuman stated, now we need to create special clips that use the resolver values. It feels like we are working for the system rather than this system providing a better solution for an age-old issue of animating complex characters.

It saddens me to say that after all these years, third party assets still do a better job at this common issue :frowning:

1 Like

Great feedback there. I agree that animating things in the animation window is quite clunky, with very few inspector gizmos to help you create the motion you are aiming for. I like your example of how you would like to work with a spline. I’ll add this to our internal feedback system.

Regarding flipbook animation w. Sprite Libraries as its starting point, since an Animation Clip already is a collection of assets, it feels like we are pushing users to create one collection of Sprites (Sprite Library) in order to generate a second collection of Sprites (Animation Clip). What we want to explore are ways to generate an Animation Clip with fewer steps. The “drag Sprites into a scene to create a GO and Animation Clip”-action is more in line with what we want to explore, as it requires very few steps. However, as you pointed out, customizing frame rate is missing. It is also quite a hidden action, and I think a lot of users are unaware of this one.

@DavidNLN could you expand on why Sprite Libraries/Sprite Resolver is not helping you with full character customization?

Yes, this is why we would like to spend more time looking into flipbook animation. It is a form of animation which is widely used, but we can for sure do better to make it easier in Unity.

Thanks for the feedback, do keep it coming if you have more things to add.

Hi!

How can I limit FPS in the window of the 2D Animation Editor? :sweat_smile:

Here is the screen - I do nothing, but after a few seconds of being in his window and this “nothing”
-all the fans of my laptop begin to howl and the temperature of the processor and the GPU - crawls up!

In general, this is the “trouble” of the Editor Unity as a whole.
And I’m already tired of fighting it…
But in the last beta, the editor’s behavior has changed - he no longer tries to Maximum FPS just when watching an empty scene :slight_smile:

May be this is a Victory… :smile:
And dear Developers have changed something and it no longer needs this shamanism with the assignment of an Application.targetFrameRate right in the Editor, not only PlayMode

I hope :slight_smile:

But in the window of your Editor - everything is still…
It’s very difficult to work with him like this.

P.S. The second screenshot shows how after exiting the 2D Animation editor, the processor temperature immediately began to decrease

Hello @EvOne ,
We do not have a way for you to set the frame rate of the Skinning Editor. However, it would be good if you send us a bug report with this issue so we can take a closer look to see how we can improve it.
Thanks!

1 Like

Hi @Ted_Wikman , sure, first of all, let me apologize if I came off a bit too aggressive with my last comment. I was very frustrated after a day of trying to make it work.

For reference, Here is what I ended up making: x.com

Unfortunately, I gave up on using the sprite library and instead wrote custom code that replaces the animations via my own “sprite library” kind of thing.
There were several issues using it.

First, you must create your own animation clips that modify the sprite library property. I ended up generating the clips directly from the editing software via post-process class → this should most likely be automated if the sprites are in a sequence like so:

I should not have to create a clip for that. Imagine having hundreds of animations throughout the game.

Secondly, When having a broad character creation that includes gender for example, you would most likely create two sprite libraries, and one of them would be the main one, but then, for every frame you want to replace the main one, you would need to drag and drop the correct frame to the correct slot as there is no way currently to select all frames and drop them in, again if you have a few hundreds of animations like these you will lose a finger doing this.

But all of the above are mere inconveniences. The true break moment came to me when trying to add eyes, hair, clothes, and everything else.

Suppose you add a new category to the sprite library, eyes, and add the default eyes to it, but wait, we have more than just the default eyes, so how would I add them? Add a new category? eyes2, eyes3eyes24?
But the resolver switches between libraries, not categories (which makes sense), so that won’t work.
Ok, so we need to create a library per “body part,” so a sprite library for body, eyes, hair, etc…
But you can only have one resolver per object, so you would need multiple resolvers, and then you would need to write some script to sync them all.

At this point, I realized this was too much work. I sat down and wrote my own “library” and “resolver”
The resolver sits as a top-level script like so:

It allows me to both play with it in the editor and it works at runtime it reads the clips from the library and makes sure to switch them at the animator when they change.

2 Likes

I can see from your screenshot @DavidNLN that you are trying out the new Sprite Library Editor window from 2D Animation 9.0. We’ve added some automation in that window to make variant creation easier and avoid dragging sprites one by one. If you drag and drop several sprites (or a texture containing several sprites) into a category, it will go through all labels in that category and replace it with dragged sprites whenever their name match.

There are some more rules for characters created from PSD files where you can drag and drop the file and a new category will be created for each group in the PSD and a new label for each layer. There is a documentation page coming that will show how to use it.

So since it seems clear that Unity won’t be restoring the ability to create sprite libraries from PSB categories like you could in 5.x, is there a way that I can add that capability to the sprite editor?

1 Like

I have seen developers extending the PSD Importer to generate their own sub assets, however, these solutions were quite hacky. We are looking into ways to allow developers to extend the PSD Importer, to generate additional sub assets on import, but we do not have anything concrete to share with you all at this point in time.

1 Like

I see.

I’m also curious whether support for using skinned sprites as a sprite mask (without adding a bunch of layers and render features) is planned for some point?

2 Likes

We currently do not have any plan for this, but do let us know how you would use it, so that I can note it down as a feature request.

Well, in my case I’d like to do a particle-based effect on an animated sprite. The particles should only render on the sprite though (inverted mask). It would be a cool feature if sprite renderers with an animation could act as masks (ideally with a toggle whether to display the sprite too or not).

I’d use it exactly like any other sprite being used to mask other sprites using the mask feature. It has dozens of applications, from shading to confining particles or liquids to a shape to overlaying powerups and buffs on characters. Or, as in the character I’m working on at the moment, confining eye sprites to the shape of the eye socket.

Currently, when applying a sprite mask to a skinned sprite, the deformed vertices are not updated in the mask component, so the mask ‘works’ but does not deform or move with the bones(which makes it essentially useless).

Sprite masking has been a feature for a long time, and it feels really annoying to need to create two extra layers plus adding two additional render features just to replicate it.

2 Likes

I should have had my morning coffee before answering. In Unity 2023.1.0a5, Sprite Mask now supports deformed Sprites (link to change log). Give the alpha a spin and let us know if supports the use cases you have in mind.

2 Likes