2D Animation is out of preview for 2019.3


From 2019.3 onwards the 2D Animation package is out of preview and verified. This means that the 2D Animation package is stable and will receive regular bug fixes. We will continue to add new functionality and these features will be clearly marked as experimental to distinguish it from the more stable features.

Overview
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.

Experimental Features
This package also includes experimental support for Sprite swapping workflows.

Getting Started

Optional Install for Improved Performance

The performance of the 2D Animation package in 2019.3 can now be improved with an optional install.

What is it?

This release optimises performance for high bone counts (this includes current performance gains for complex Sprite meshes with high vertex counts).

Animated Sprite deformation at runtime will get a performance boost by installing the Burst and Collections packages from the Package Manager. This allows the 2D Animation package to use Burst compilation and low-level array utilities to speed up Unity’s processing of Sprite mesh deformation.

Getting Started

Note: As the implementation of the performance boost might contain bugs, you can have any Sprite Skins switch back to the previous implementation by clearing this option in its component settings.
With the packages installed, the Experimental Enable batching setting becomes available on the Sprite Skin component. As the implementation of the performance boost might contain bugs, you can have any Sprite Skins switch back to the previous implementation by clearing this option in its component settings.

The package is currently tested based on Burst version 1.1.2 and Collections version 0.1.1-preview.

4 Likes

(Moving my question here, as the “preview”-thread where I asked the question is now closed)

Hi!

(Thanks to your post above I found the performance-mode, thank you!)

Am I correct in understanding that the 2DAnimation will be more efficient in the future? If so do you know the approximate time-frame, and will it be able to compete with the performance of Anima2D?
The reason I’m asking is because I’ll (possibly) have 5~15 NPC on the screen at once, and currently 2DAnimation is too performance-heavy to use for this, while Anima2D does the task without affecting fps much.

2DAnimation is such a lovely and easy to use tool though, and I would prefer using it as it’s also native to Unity now. So If it will be efficient enough in the future to handle this well I’d love to know, then I will fix my animations in 2DAnimation and wait for the efficiency to come :slight_smile:

1 Like

Is there any update on allowing other formats for the “Multiple Sprite Single Character rigging” or for setting up the character yourself with a flat file? The Photoshop format requirement is still causing me not to use this in production.

3 Likes

Due to the change in the status of the 2D animation package and the closing of the forum preview branches, I will ask my question again here in the new branch, since the answer is important to me. And my past comments with related questions go “to the background,” along with those closed forum threads.

-Are there any plans to expand the functionality of the PSD Importer to work with Adobe Illustrator?
As an artist drawing in a vector and not using Photoshop in my work, it’s very important to know, for me

Here is the original comment about the situation with the layer identifiers in Illustrator and how this excludes the possibility of working with Adobe Illustrator and the current version of the 2D animation package
I’m not sure whether to duplicate the whole comment here, let there be a link:
[#414]( https://discussions.unity.com/t/725306 page-9#post-5414988)
Leo-Yaik answered me, but since I managed to ask several questions, his solution probably suited several of them, and there was no citation in his answer - I’m not sure I understood what question the answer related to… :sweat_smile:

Therefore, I asked a clarifying question, the answer to which has not yet been. And then you closed the branch in which I asked him… :smile:

Original post - here:
[#418]( https://discussions.unity.com/t/725306 page-9#post-5418102)

A small quote from that comment, to make it clear why I am so worried - my workflow is completely dependent on the possibility of fully working interaction with Illustrator.
And description of the script for AI that I use to simplify working with characters and simplifies the export of .psd and import to the PSD importer:

Here is a link to the video in which I tried to briefly show the main features of my script:
-Switching “skins”, variations of objects: hands, feet, head. Just select from dropdown lists, without clicking on many-many smallest icons of Illustrator’s Palette of Layers!
-Create a new object from the selected. The name of the layer contains the name of the body part, the “skin” and the variation of the body part
-Creating a file prepared for export, and export to psd.

As you can see, there is already much that will make it more convenient to work with many drawings of various characters. Although of course the script is still very “raw” and not very stable, but nonetheless…

https://www.youtube.com/watch?v=5Tp6CZ7vJJU

P.S. Sorry for my “pidgin english” and Google-translate… :sweat_smile:

could you add CLOTHES or WIND effect support? to deform clothes, scarfes, flags and so on with the wind?

5 Likes

Is there a way to dynamically add the PSB files to the scene via C#? I’m having a hard time implementing the PSB game object with all the bones into the scene, I can very easily add it by drag and drop, but that doesn’t really work with the game I’m making.

Thanks!

1 Like

According to the manual: "

  • Add the Sprite Library component to the same GameObject, and assign the new Sprite Library Asset set up in step 3 to the Sprite Library Asset box.

  • Add the Sprite Resolver component to the same GameObject.
    " and so on…
    I have firstly rigged my character, then I did what I cited from the manual and then I switched a body part, getting Sprite has no binding… WHY? How solve it? Why doing like the manual is not working?

10000000981190--565273--sprite.png

When I set sprite bones in editor script using SpriteDataAccessExtensions.SetBones, these bones are not saved to meta file and are not visible in Skinning editor. What else should I do to see the bones in Skinning editor?

2 Likes

We will continue to improve PSDImporter support by addressing a more robust way to maintain layer to Sprite reference.

Thanks for taking the time to try out Sprite Swap feature. At this moment is still experimental and we are still trying to iterate on it. The workflow is not final at this point and a rework is on the way

2 Likes

The Sprite Swap currently has the limitation that the Sprite that is being swap into needs to have the exactly same bone influence. As mentioned in the previous post, we are working on the next iteration of it.
https://docs.unity3d.com/Packages/com.unity.2d.animation@4.1/manual/2DAnimInter.html

1 Like

Can you give a more concrete example and use case?

1 Like

Metafile data can only be written during an import process. Thus doing this outside the import process will not save the data back into the metafile. To do this, you will need to hook on to AssetPostProcessor.OnPostprocessSprites to modify the data.

Thank You Sir! -You can’t imagine how glad I am to hear that! :slight_smile:

And this is absolutely not scary, I’m writing this script myself, and I can fit it practically to any requirements … :sunglasses::slight_smile:
The only situation that is practically unsolvable for me - is this one with layer identifiers that are not working in Illustrator.

But if this is somehow resolved, then everything will be just fantastically wonderful!

the problem is this:
I Rigged the charchter with its default skinset. Then I want to swap in at runtime another sprite taken from an asset bundle. Even when I drag another library asset into the component “library asset experimental”, the resolver says “sprite has no bindings”.

it shouldnt automatically swap the sprite there, like its shown into the Example package with the viking Rikr?

I rigged a character with its deafult HAT. Now I want to swap in other HATS taken from other asset bundles.
Am I forced to create a totally different charcher and psb file for each hat and copypaste? that would be crazy.

I want just to swap a new hat in but I get “Sprite has no bindings” I dont understand what should i Do in practice… could you explain step by step? Thank you, it’s very important for me!

If you look at the individual Rikr sprites, they are all rigged seperately such that the bones name and count are the same corresponding to the other variant that it needs to swap with.

I JUST want to swap only a single ITEM, a single weapon!
Most of modern games are based on the economy of selling weapons/gadgets, and this is critical!
I can’t create a rigged prefab character for each weapon I have!!

I want to swap in a single item (an hat, a sword). Taken from a random AssetBundle.
I rigged and animated the character with a placeholder for the hat and another for the weapon.
Now I just want to swap in an hat/weapon of the same dimensions, right there.

Please could you explain how to do this? step by step. How should we do?
This is the core business of most dev studios!

1 Like

what do you mean the same bone influences? you are omitting that then we are forced to create a prefab for each variant of the character? then copy paste the skeleton and istantiate them like:
-Mario with sword
-Mario with Axe
-Mario with bowl
and so on? that would be crazy!
and what about combinations?
-Mario with Red hat and Sword
-Mario with green hat and sword
If so, you should state this huge limitation in there…

From the documentation looks so cool an easy to swap things, instead is only if you want to swap total body charcters like winter clothes/summer clothes or some sprites that are loaded into the same PSB file, not external sprite!

This makes impossible to work with the suggested recommendation of unity, Asset Bundles, Memory mangement and so on…

I don’t know if I have understood correctly, I hope to be wrong, because in that case our studio will be stucked, since we have tons of assett bundles with weapons and so on, waiting to be swapped, and we cant merge them inside each prefab. Waiting for this critical feature.

Instead if there is already a solution, Please could you explain it clearly?
Thank you very very much!

I was wondering how to add single sprites to swap too, and this is the solution I’m using right now:

Making the swappable sprite-image:
1. Copy the PBS-file that holds your current character-sprites.
2. Open the PBS-file.
3. Delete everything in the file EXCEPT for sprite you will want to swap out, so for example keep your weapon-sprite but delete everything else.
4. You should know have an identically sized PBS-file with only one sprite (your weapon-sprite). All your other character-images are now gone.
5. Repaint the weapon-sprite to a style you wish to be able to swap to. Make sure the repainted weapon is approximately where the original weapon-sprite was.
6. When you’re happy with your repaint, save this copied PBS file and import it to unity.

Setting up your new swappable sprite-image in the Skinning Editor.
7. Open your original PBS-character-file in Unity’s Skinning Editor.
8. Cope all bones of the PBS-character-file
9. Go to your new PBS-file with ONLY the weapon.
10. Now press “paste” on this file, (you’ll find the button at the top of the Skinning Editor).
11. Choose to paste “Bones” only. Pasting the mesh will not work as you don’t have the same number of sprites.
12. Now the bones should be in your PBS weapon-file. Now that you have the bones in your new PBS-copy you can create a new mesh for your weapon and attach it to the bones. Edit it to react as you wish to the bones here.
13. When you’re happy with how the weapon reacts to the bones, hit apply.
14. This weapon will now be a swappable sprite with all your other weapons if you add it to your Sprite Swap Library :>

That’s my workaround for now. Like this you can make a PBS with ONLY the image you wish to swap, so you don’t need to set up a whole character every time. If I’ve understood correctly however they’re working on a more streamlined solution, so in the future it will probably be easier. But I think this solution works fairly well right now :slight_smile:

3 Likes

Thank you very much for the help! However this means I should rig evertyme the charcter for all the weapons/hats/accessorize! That is a crazy amount of work. And this means that when we istantiate that, there would be in memory a duplicate skeleton!

If I want to change my charcter to have a sword instead of a woodstick I have to be able to do it in 1 second!
Saving the rig I have already done! And no rig again every item for each charcter! It’s insane.

I hope they can fix this in this week, it’s very crucial for us, it’s a core business!