2D Animation 6.0 released for Unity 2021.1

2D Animation 6.0 released for Unity 2021.1

What’s new?
With the release of Unity 2021.1, 2D Animation 6.0 has been verified. Here are some of the improvements 2D Animation 6.0 comes with:

Sprite Swap improvements

  • Sprite Swap is now a part of the general sprite workflow (and not just for skinning within the Sprite Editor for 2D animation).

  • UI for the Sprite Library component has been improved to clearly display Categories and the Labels within them.

  • Sprite Library now supports drag and drop to simplify adding additional Sprites.

  • Make sure to read the section on changing the keyframe tangent to make animation work well for Sprite Swaps.

Skeleton sharing with 2D PSD Importer

  • The Main Skeleton property allows the user to assign a Skeleton Asset to indicate that the asset will be using a bone hierarchy structure previously setup from another asset.

  • When this property is assigned, the Skinning Module will use the bone hierarchy provided by the reference Skeleton Asset for rigging.

  • If this property is not assigned, a Skeleton Asset will be generated as a sub-asset for the source asset file that can be used later for other assets to reference.

See the full changelog here.

About 2D Animation
The 2D Animation package adds tooling for rigging a sprite for skeletal animation. This package 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 Multiple Sprite Single Character rigging workflows through 2D PSD Importer Package.

Getting Started
In an existing project in Unity 2021.1:

Creating a new project in Unity 2021.1 by selecting the 2D Template in Unity Hub will also install 2D Animation 6.0 by default.

Explore the Samples
2D Animation comes with Samples showing the features in action.

To get the samples:

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.

Additional Information
Optional Performance Boost
You can improve the performance of the animated Sprite’s deformation at runtime by installing the Burst and Collections package from the Package Manager. This allows the 2D Animation package to use Burst compilation to speed up Unity’s processing of Sprite mesh deformation.

The Burst package is visible by default in the Package Manager. To install the Collections package, follow these steps:

  • Open the Package Manager.
  • Press the + in the top left corner and select Add package by name…
  • Input com.unity.collections and press Add.

7126691--851357--Add Package by Name A.png7126691--851360--Add Package by Name B.png
Once these steps are completed the Collections package will be available in the project.

With both packages installed, the Enable batching setting becomes available in the Sprite Skin component. As the implementation of the performance boost might contain bugs, you may switch back to the previous implementation by clearing the Enable batching option.

7126691--851363--Enable Batching.png

The package has been tested with Burst version 1.3.3 and Collections version 0.9.0-preview.6.

Note that if you do not have the required packages installed, the option will be disabled, with a notification to install the required packages.

7126691--851366--Install Burst and Collections.png

SpriteSkinEntity deprecation
The SpriteSkinEntity component was introduced in the 2D Animation preview package to leverage the performance provided by Unity’s Entities package. However, since 2D Animation is a verified package, and the Entities package is still in preview, we have decided to drop the support for the time being.

In 2D Animation 6.0, we have not removed the SpriteSkinEntity component to ensure that older projects that were using the preview version of 2D Animation are able to upgrade successfully without any compile errors. However, if your project is using the SpriteSkinEnity component, you will see the following warning in the console:

“SpriteSkinEntity will be removed in 2D Animation 7.0”

If you click the warning message, the GameObject with the SpriteSkinEntity component will be highlighted in the Hierarchy window.

As stated in the warning message, we will fully remove the SpriteSkinEntity component in 2D Animation 7.0. Make sure to remove the component for a smoother upgrade to future 2D Animation versions.

Installing Collections will install Burst automatically. :slight_smile:

Not only is it available but it’s also enabled by default after the packages have been installed.

1 Like

Hi,

I have a request. I recently reworked my textures mainly by reducing their size, making the limbs thinner and so on. On importing the new sprites, it appears that the geometry didn’t update automatically in the Skinning Editor, I had to do it manually.

Is there any possibility we could have an update function that would affect only the outline, respecting the customizations we made to the geometry, once?

Thanks for the great work anyway !

3 Likes

Thank you for the feedback and your kind words, @ . I’ll note this down in list of feedback for future 2D Animation improvements.

1 Like

“Inconvenient” question about SpriteSwap. Again.

I (and not only I) - have already asked about it, long ago
([#383]( https://discussions.unity.com/t/725306 page-8#post-5207591) , [#211]( https://discussions.unity.com/t/774462 page-5#post-6364455))
when the 2D Animation package was still quite small.
Now he has grown to the 6th version, got a new feature and improvements of old, but …

-Why still Sprite Swap still works like this?
(I really do not understand :smile:)
7189639--862645--u2021_t01-1.gif

Despite the “answer” and the closing of the report in FogBugz and “Explanations” about Meshes, Bones and Pivots…

-Just look - after completing the import of PSB-file, the Importer had ALL information about all Layers - the exact location and size!
And the 2D Animation package itself, before Sprite Swap - can use this information!
But it is necessary to include this Sprite Swap - and everything shifts to hell.

Then how is it offered to use this functionality?
Does it really need to track the actual size in the pixels drawn on the graphics layer?
So for all interchangeable parts, this size was the same?

No, it can not be that you offer something as a real workflow of the artist and an animator!
-I do not believe…:face_with_spiral_eyes:

-But then what is the advantage of using the importer in this case?

The information about ALL the layers and drawings on them - was relevant, but correctly automatically positioned the replaceable parts - it is impossible … Why?

(and this is just one of many “why” that appear when trying to work with 2D Animation and PSB Importer)

P.S. About Reply on FogBugs:
7189639--862648--2021-05-30_11-30-34.png
“Relative” - yes, for sure.
And also - the location of all replaceable parts relative to each other and relative to the entire file - also known.
But this information is lost and not used.

Just upgraded 2D Animation and noticed that Sprite Swap related instruments were removed from Skinning Editor, so I have a few important questions.

  • What should I do with objects of the same category when I add Sprite Resolver components to game objects inside of a not unpacked prefab? Let’s say I have a category “Hat” with 3 sprites, “Red”, “Blue”, and “Green”. I have similar 3 objects inside of a PSB prefab. I add a sprite resolver comp to one of 3 objects, then what should I do with other two objects? Disable them won’t brake the prefab, but it creates a lot of visual garbage in a hierarchy window if I have many such objects. I can’t delete them without unpacking a prefab. Before 2D Animation was updated it was possible to convert groups into categories and the prefab you get would only contain one game object per category.

  • What we are supposed to do with manually added Sprite Resolver components when we update a PSB prefab now (reskin, edit layers, reslice, etc)? Will they persist? I did a few tests and it seems they persist when I edit the source, but I learned on my own mistakes that it’s better to not add components to objects inside of a PSB prefab if I don’t want to lose these components.

  • I guess there is no simple way to convert folders into Sprite Swap categories with the new workflow?

2 Likes

The issue you are seeing is because you are swapping two Sprites with each other that has different sizes and are not using their pivot points to account for this. We have noticed that this is an issue that some users using the Sprite Swap feature are wrangling with. In 2D Animation 7.x (for Unity 2021.2) we have added a section in the documentation to explain a bit more how you can fix the pivots of your Sprites to create better swaps. I will link it once it is available.

Regarding us making an auto solution for setting pivot points on import, we have looked into this but currently we haven’t found a good solution that works for the general use cases. We have the positions of the pieces in the PSB file, but we do not know by just looking at the positions where the piece want its pivot point. An arm would want it’s pivot point closer to the top center position, while a left foot might want its pivot point center left. Currently, we haven’t found a good data point we make these assumptions on. It is a feature we would like to have in the solution, but we cannot promise if/when we can deliver it.

While you wait, there are ways to create great looking swaps:

  • Tweak the pivot per Sprite so that all the Sprites that are going to swap end up on the same location.
  • Show/Hide GameObjects with the different SpriteRenderers and Sprites to “Sprite Swap”.
  • Generate a mesh and skin the Sprites to a bone inside the Skinning editor.
1 Like
  1. You can either unpack the prefab and update it to the hierarchy you would like to work with, or create one .PSB per outfit, so you would have MyCharacter_Green.psb, MyCharacter_Blue.psb, etc. The nice thing with using multiple files is that you allow yourself to only load in the assets you need, rather than having all of the customisations in one big file that has to be kept in memory at all times.

  2. The .psb file in Unity can be seen as a “view” into the file. If you drag the .psb file into your scene, add components onto one of the GameObject children and then remove that child inside Photoshop, the GameObject will then disappear in Unity. My advice is to create a prefab using the .psb file, and then add your components in that prefab to make sure its structure will stay intact while you iterate.

  3. Not whole folders, but you can select multiple Sprites and drop them into a Sprite Library Asset to quickly populate a category or create multiple categories with the selection.

And now a question for you @berdanka , how would you like to work with the tools? How does your pipeline look like and are there any places we could improve the tooling to streamline your process?

  1. create one .PSB per outfit works well when your problem is just outfits. What about frame animations? Let’s say I have 10 eyes, and 5 mouths, and 6 different hands. Creating a PSB per every state of every body part is just… not the best option.
  2. Yeah, I store my components ‘outside’ now.
  3. I can live with that. But please, let us reset groups converted into categories in a previous version of package. All my old PSBs stuck with undeletable Sprite Library Assets now, and child objects stuck with Sprite Resolvers.

Well, my workflow is mostly dictated by tools I have at my disposal. I just trying to minimize using of external software. I hate baking animations and for awhile I used Spine for rigging and animating my rig in Unity later. It was pure hell. If it isn’t simple to make edits to a source file with 2D Animation package, you can imagine how hard it was with Spine and its runtime. Now I can work mainly in Unity and explore new options. First time I studied Anima 2D, I really enjoyed Unity chan demo. Since then, I started using complicated rigs with physics, transforms that deform rig’s scale by inertia, etc. Most of all, I wish the Unity team would think of their end users as maniacs who create rigs with 100 sprite layers or more. As anyone, I prefer batching to manual work. And I prefer PSB metadata to be foolproof and package-upgrade-proof. Losing a huge rig of bindings is just straight painful.

  • Please give us a way to edit PSB layers names in Skinning Editor. Expecting you (or your artist) can name everything right from the beginning is too much. And, when mapping is done by layer names, you can’t just edit the source without suffering.
  • Let us to flag layers we want to see converted into game objects inside of a PSB prefab. Please? It’s going to solve the visual garbage problem. All rigged layers are still going to be available for Sprite Swap workflow, but only those layers you marked as visible should get to the scene when prefab is instantiated.
  • Consider resetting the Reslice toggle to false in PSB importer after reslice is performed. It gives me anxiety every time I see it ON after changes were applied already.
  • Please give us an option to decide how much we want to trim our sprites in PSD importer. It doesn’t matter how much you extrude your edges, automatic slicer will always trim sprites. Edges around sprites in atlas are not only good against bleeding, sometimes you want to create vertex outside of visible sprite, but sprite bounds won’t let you do so. Sure I can edit sprite bounds manually just to be overwritten again after reslicing.
  • Binded vertexes could show pie charts (optionally) when you edit weights.
  • Auto Geometry outline detail 0 is still too detailed. Sometimes you have just one bone per mesh and auto geometry creates tons of vertexes when it’s cheaper to have just two or four triangles. I don’t use Burst and in my case every additional vertex costs me FPS. Even if most of them are bind to one bone. It’d be great If you could give us a way to limit a total vertex count for Auto Geometry generator.
  • I wish I could have FFDs to speed up my workflow. Instead of binding 999 version of different eyes and mouths I can parent them to a rigged FFD mesh named ‘Head’ and forget about their existence. The easiest way to implement them is… to let us create empty meshes without sprites or convert PSD groups into such meshes. Every child mesh can be binded to its parent, maybe optionally. FFDs should be controlled by bones, potentially by pins, and vertexes.
  • I also want something like a rotation weight slider for bones. A way to limit bones’ influence to movement only, without rotation. Or with some amount of it. The reason is that when you animate a bone, sometimes you get unwanted deformations depending on how far influenced vertexes located from the animated bone. A small rotation of a bone can result in far away vertexes moving trough the whole screen. Well, I can combat it with hacks to a degree.
  • I also wish we could have pins. Pins are basically… same bones but with weighted tangents controlling how straight the bone connection is. Having option to decide if bone’s connection should be linear or curved will be a big help for artists.

That’s what comes to my mind first and what is related to 2D animation package and PSB importer.

3 Likes

Thank you @berdanka for giving us all this feedback. I especially enjoy feedback where we also get to know why a certain change is needed and what it will improve. I have shared this with the 2D team and we will use this feedback as one of the data points to improve future 2D releases.

One thing I am curious about is your reasoning behind not using Burst in your project. Have you had any bad experiences using it previously?

I tried to install it once when I still used Unity 2020 or may be even 2019, but it didn’t work. I had some errors which content I can’t remember and I decided to wait for awhile.
Thanks to your comment I just did installed Burst and Collections successfully. I should say it really improved the performance of rigs. The more characters I have rendered at the same time the more effective it is. I got about +40 FPS for spending 2 minutes. Thank you. Now I probably can stop wasting my time on editing meshes for every small thing.

2 Likes

Great, thank you for trying it out. We are looking at making Burst and Collection a mandatory dependency in a future version of 2D Animation, so we are very interested in hearing if any devs have issues/reasons not to use it, so we can fix those issues before rolling it out to everyone.

I was about to ask for this. :slight_smile:

1 Like

I only use the 2D animation package for the sprite swap features. What would I need burst or collections for? I’d rather not take on those dependencies not necessary.

But I have a question related to the Sprite Resolver and Blend Trees. Is there anyway to have 2d blend tree only use the animation node with the highest weight so it doesn’t interpolate the sprite key variable?

7212130--866770--upload_2021-6-6_8-59-10.png

I have some ideas on how to fix this code wise where I pass in animator parameter values that perfectly align to the x and y positions for each motion as seen above. Can anyone think of any alternatives. Maybe some flag that can be passed to a blend tree of animator. Maybe some way to change the weighting system used in blending between nodes?

Thanks!

1 Like

Also I’m getting this warning. Not a huge deal but having Unity generated warnings is super annoying.

No script asset for SpriteLibCombineCache. Check that the definition is in a file of the same name.

Hello @jehk27

Collections and Burst will speed up sprite deformation, but will not do anything to your Sprite Swaps, so you can leave those packages out if you do not wish to have them in your project.

Unfortunately, you cannot in the current versions of 2D Animation. This is a high priority ticket item that we are looking into and hoping to solve in a future version of 2D Animation.

Solving your issue in code instead of in the animator will most likely be the “cleanest” solution. But you could also solve it in the blend tree. Since the issue is the blend between two states, you could add additional states to make the blend area as small as possible. In a 1D blend it would look something like this:
Weight 0: Clip 0
Weight 0.24: Clip 0
Weight 0.25: Clip 1
Weight 0.49 Clip 1
Weight 0.50 Clip 2

and so on.

Thanks for the heads up. We have a fix for this issue in the next version of 2D Animation.

2 Likes

So they are optional packages that, when installed, will yield performance benefits for sprite deformation?

Cool. Good to hear. Animating the sprite key took a bit of getting used to. The closer the workflow is to animating sprites the better. Having said that its really not a big deal once I read over the docs explaining the workflow.

It ended up being pretty easy to solve in code. I’ll play around with this this idea a bit though.

Also, thanks for the work on the sprite swap functionality. It’s seriously going to save us a ton of time. You rock.

Correct, with those packages we can burst compile the deformation methods and run the deformation threaded instead of on the main thread.

Great to hear that you managed to solve your issues, and thank you for your kind words!
Let us know if you encounter any other issues, and if you have any ideas on how we can improve the current 2D toolset, do let us know here.

Happy devving!

Can we have an extra solver for IKManager2D which is a simple Controller that only controls one bone (effector)? Its position + rotation + scale to be precise.
We’re able to animate any bone directly, so why we need a solver for that? The reason is simple. Bone structure is ever changing and unreliable because animator depends on object’s paths to find animated properties. For example, once I move leg bones from ‘torso_1’ to ‘pelvis’, animation stops working. Once I rename any bone it also brakes everything. The more complex your bones structure the more you suffer. Different paths of animated properties also the cause of visual confusion for me during animation. It would be nice to have all animated objects in one place. My solvers are stored like that, but I don’t really need inverse kinematics to control every bone.
Most of other mesh animation programs and assets are featuring such controllers, they indicate them by square gizmos.
I’ve attempted to add my own solver for that by extending from the class Solver2D, but it won’t show up as a new solver under the solver menu no matter what I do so I gave up trying. Currently I have a simple script that is copying transform values for me, but it doesn’t work in editor well because it conflicts with IKManager2D. Undos and default pose restoring is problematic.

1 Like