Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Official 2D Animation 7.0 released for Unity 2021.2

Discussion in '2D' started by rustum, Oct 25, 2021.

  1. spacefrog

    spacefrog

    Joined:
    Jun 14, 2009
    Posts:
    670
    Thanks Ted for the clear answer.
    I'm not directly affected by the licensing issue. I just thought, if Unity had entered some license agreement with the original author, i could use it for totally different purposes ( meshing of my own geometry ) without having doubts about it's legal state. Anyways, i found an alternative triangulation library which i use know for my meshing needs
     
    Ted_Wikman likes this.
  2. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    413
    2021.2.8f1 and I'm happy to report you are correct, it is supported! The problem in this case was "user error". PSB files cannot be directly dragged into the atlas "packables" list like a .PNG file can be and I took this to mean .PSB is not supported. Now I just tried a folder of .PSB files instead and YES! :)

    Thank you for clearing that up!
     
  3. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Great that you managed to resolve your issue, and thanks for the feedback about the .PSB not being drag-able into the packables list. I'll add this to our list of feedback.

    Happy developing!
     
    LilGames likes this.
  4. ebmarsak

    ebmarsak

    Joined:
    Nov 4, 2021
    Posts:
    1
    Example from Unity: https://imgbox.com/31FO2yPx
    Example from Spine2D: https://imgbox.com/owK6dH3y

    [The same two example pictures are also uploaded as attachment in the post below.]

    In my Spine2D setup, I have two different hair skins. Green hair has some extra bones attached to it. The blue hair has no extra bones. When green hair skin is active during animation, it brings the bones attached to it. When I switch to blue hair skin, the bones from the green hair skin disappear, they don't exist at runtime during animation too. This system helps me make a very big skeleton asset and basically throw every skin and animation into it. Then all my characters, even random generated NPC's with random skins inherit from this skeleton asset. Good thing is that I don't have any performance issues because at runtime, there are only necessary bones and sprites appear and animate for that specific character on the screen.

    So I want to make a similar system using Unity's 2D Animation and rig system. When I imported 2D animation package samples, I tried to find a similar but the closest I got was that girl animation with two different hand gestures. When you change the skin at runtime, hand sprite changes but unnecessary bone still exist and keep animating. This would cause a lot of performance issues in my project because I have too many body parts/skins/extra bones etc.

    Is there a way I can achieve the same thing in Unity without using Spine2D? Also, do you have any plans of developing a skin system similar to the one inside Spine?
     

    Attached Files:

    EvOne likes this.
  5. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    870
    Can't you just disable that additional bone(s) through some trigger when the hand pose switches and reenable only once it's needed again? Assuming the animation system does ignore disabled objects.
     
  6. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    @ebmarsak so when you are swapping from one Sprite to another, you want to generate the bone hierarchy from the new Sprite? We currently do not have this functionality. My worry with this setup would be the runtime impact, since it would mean creating and destroying game objects on every swap.

    When you are speaking about performance issues with regards to too many bones, what performance impact are you referring to more specifically?
     
  7. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    870
    That would be a good opportunity to use the new game object pooling system, wouldn't it?
     
  8. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Yap, that could be one approach to solve the issue
     
  9. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    413
    You're moving the "line". But I agree the vertex detection is a little too precise.
     
    DragonCoder likes this.
  10. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    870
    Indeed it's quite cool and suffices for many things!

    Still there is a fair share of potential left.
    Dual quaternion skinning would be great for example. It helps preserving volume. An issue I've ran into quite a bit. There is a brief description for that here: https://www.kestrelmoon.com/creature/more_info_2.html

    Another thing would be some mask support so we can for example blend a particle system ontop of an animated character (without bleeding over the edge) or misuse the plugin for some special effects.

    Hope the staff gets asigned some capacity for this plugin again some day aside of maintenance :)
     
  11. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    172
    There is even no FFD in Rodamap (and not planned) :oops:
    What a "quaternion skinning"... :D
     
  12. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    870
    Was thinking of mentioning FFD but think that's a way larger topic. Quaternion skinning should be something that can be added without adding lots of features to the UI side (as FFD would require).
     
    EvOne likes this.
  13. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Thank you all for your feedback!

    @Uppet000 could you show us how the vertex selection fails? @LilGames is correct in the statement that we also allow for edge editing (moving the "line" between two vertices), but maybe the selection area for vertices is too small and would need to be bumped a bit.

    Onto your second point, @Uppet000
    Could you expand on this? What preferences could we add to make the toolset easier to use?

    @DragonCoder thanks for sharing the dual quaternion skinning technique. With our current toolset, we would advice you to add additional vertices (both internal and external) to get a better bend. But we are always looking for ways to improve the tools and make it easier to use.

    Like I've stated earlier to @EvOne, our current goal with 2D Animation is to make sure that the foundation is reliable, easy to use and performant. Once we feel like we have accomplished this, we will start looking into adding support for more advanced 2d animation techniques. In the meantime, if your project does require more advanced 2d animation techniques, there are great 3rd party tools out there which integrates well with Unity.

    Keep the feedback coming, we love to hear what we can improve to make it more enjoyable to create animations in Unity.
     
    EvOne likes this.
  14. streeetwalker

    streeetwalker

    Joined:
    Jun 4, 2013
    Posts:
    327
    OK, Unity 2021 LTS is here and we are considering the upgrade to take advantage of the new features of 2D Animation 7.0 package.

    Before we embark on this upgrade, I need to scope how how we can handle this situation (because I believe the 7.0 upgrade makes this possible):

    We currently have avatars with swapable clothing, made possible by the SpriteResolver component and the SpriteLibrary that is genrated from a PSB file we have rigged to the avatars. So our players can choose their avatar's shirts, pants, shoes, hair style, and accessories independent of each other. We've set all this up in a wardrobe UI that works.

    One thing we would like to do is award/reward new clothing items to our players dynamically.

    That is, we could provide a new shirt that is not currently in the rigged avatar's SpriteLiibrary, by loading a pre-created SpriteLibrary with the new clothing options in them, and add/copy the awarded clothing them to the avatar's current SpriteLibrary.

    Furthermore are hoping to do this with Addressables so that we don't have to push out an update to our app but only would need to update the addressable content that contains the SpriteLibrary with the new clothing item(s).

    Does any of that make sense, and is possible to do, and if so what would it take to do it? We rig a second SpriteLibrary on the same avatar and put/link that asset into an Addressable? (sorry, I am not the Addressables person on this project and only have a rudimentary knowledge of how they are set up.)

    Any ideas or tips are appreciated!
     
  15. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Hello @streeetwalker,
    In our 2D Animation Sample, we have a sample called "DLC Swap", which showcases how you could dynamically load in additional Sprite Libraries using an assetbundle.

    You can use that sample as a springboard to test it out with Addressables. As far as I know, it should work the same way.

    Let us know how it goes, and if you have any further questions!
     
  16. streeetwalker

    streeetwalker

    Joined:
    Jun 4, 2013
    Posts:
    327
    Thanks so much for monitoring this channel, Ted!

    I did a test update of our project last night and I have to say that 2021 LTS editor seems faster and smoother than 2019, on the M1 Mac at least, and I had almost zero problems converting our project and installing the 2D Animation 7.0 package.

    Yes, I have looked at the DLC example carefully previously, which is the impetus for converting to 2021.

    Planning our asset development strategy: I understand that we can completely replace the SpriteLIbrary referenced, but will it be possible to copy individual sprites from one SpriteLibrary to another at runtime? (It looks like it is possible, and I understand that would only exist during runtime and is not a permanent change to the library we want to copy to.)

    Our situation is that we anticipate bring additional clients on board to our app. Our first 2 clients are large resort chains in Florida and Jamaica and there are a number of venues next to these clients (eg. clothing stores, restaurants) that we will offer to represent in our app.

    We are designing ability to add new clothing options for our players avatars as rewards that will represent these add-on clients (eg. a digital copy of a real t-shirt offered in a clothing store).

    So I envision that we will be able to add clothing items as DLC, and the question is whether or not the DLC needs to include the base clothing choices as well as the new ones in the SpriteLibrary (one large SpriteLIbrary with everthing in it) and we have to swap the whole SpriteLibarary vs. the DLC only contains the additional sprite clothing choices and we can copy only the rewarded sprites to the players existing base SpriteLIbrary.

    I hope that explains in more detail and makes sense. Thanks for your additional feedback!
     
    Last edited: Apr 20, 2022
    Ted_Wikman likes this.
  17. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Thanks for reporting back how the upgrade was from 2019 LTS -> 2021 LTS. I'm very happy that you had a smooth upgrading process. We are trying our best to make it a frictionless experience.

    Yes, this is possible. Both the Sprite Library (component) and the Sprite Library Asset have methods to add categories and labels at runtime. So once you have loaded in the new Sprites into the app, you should be able to utilise these APIs to create new Categories/Labels which points to the loaded in Sprites. Once added, you can use spriteResolver.SetCategoryAndLabel to swap to the newly added Category/Label.

    Give it a go and let me know if you hit any unexpected snag along the way.
     
  18. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    I see, thanks for the clarification and suggestion. I'll add it to our list of feedback.
     
  19. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    870
    It only costs really nothing if you combine it with your pixel art idea. Higher resolution frame by frame animations would quickly consume a lot of memory.
    With coding experience it should not be too hard to write a tool for this in Unity however. In the end it DOES work frame by frame (how else?). So just render onto a Rendertexture instead of the screen and copy or save that texture every frame.

    As for the pixel art approach, that's waaay trickier. Vertex-based animation wouldn't work very well, I'd assume. Would be curious to see what happens if you animate scaled-up pixel art with vertices and then run the image through a color-limiting filter which converts every pixel so it has one of the colors used in the original image. Would be an interesting experiment, but I'd not have very high hopes. In the end pixelart only works because their makers know how to trick our binds into seeing so much more than just a few pixels.
     
  20. trapung

    trapung

    Joined:
    Jul 21, 2015
    Posts:
    8
    please runtime setters for rootBone and boneTransforms of SpriteSkin.
    plz, plz, plz,...
     
    EvOne likes this.
  21. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    904
    Some people are going that route:





    Crying Suns is animated in Spine. ANNO might be as well, hard to tell. The pose swaps look a bit too advanced for Unity Animation. Both are made in Unity, however.
     
  22. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    @trapung could you give us an example of how you would use this if we made it public?
     
  23. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Always interesting to see what is being created out there, @PanthenEye. However, not sure why you shared it in this thread. Care to elaborate more?
     
  24. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    904
    User I quoted expressed that pixel art wouldn't work very well with bone/vertex animation in their view. So I posted a couple of examples that do exactly that in Unity to a reasonable success. If it's off-topic, feel free to delete my posts.
     
    Ted_Wikman likes this.
  25. trapung

    trapung

    Joined:
    Jul 21, 2015
    Posts:
    8

    First of all,
    in runtime we can create a sprite with all of its elements, such as vertices, uvs, bones, weights, and so on,..
    it is accomplished by using runtime method like setvertexattribute, setbones, setbindposes..
    but only bones' transforms can't be created in runtime..
    this makes no sense.
    there is way to create skinnable sprite on runtime, but we can't use that?


    And too many gameobjects(transforms) issue.

    I'd worked with costumable character system using SkinnedMeshRenderer,
    but recently moving it to SpriteSkin.

    Problem is on assigning bones' transforms.
    without runtime setter for these, i have no choice but to move bones' transforms to their appropriate transforms.
    (see attached image)



    if we have setter, we have little transforms.
    how fast Unity calculates transforms, not better than no-caculation..., i think..

    please consider runtime setter for bone transform
     

    Attached Files:

    Last edited: Jun 22, 2022
    EvOne likes this.
  26. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Thank you for highlighting your use case @trapung. We will take this into consideration for future 2D Animation planning.

    For your "too many gameobjects(transforms)"-issue, I don't fully understand your setup here. You should be able to share the same transforms if the Sprites are skinned to the same bones. How does the current solution fail you here?
     
  27. trapung

    trapung

    Joined:
    Jul 21, 2015
    Posts:
    8
    I can't share those on runtime. Of course in editor, I can do this manually.

    assumes that Legs sprite has 3bones, Pants sprite has 3bones,
    and their bones are identical in hierarchy.
    how can i set pants bones transform to corresponding legs ones on runtime?

    Do i misunderstand your comment?
     
  28. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Lets say you have the following hierarchy:

    where Renderer has a SpriteRenderer and SpriteSkin component. You have two Sprites (Leg & Pants) which are both skinned to bones named LegBone_0 and LegBone_1. The SpriteSkin has LegBone_0 set as the Root Bone. The SpriteRenderer has the sprite Leg assigned to it at startup. At runtime (or during edit time) you assign the Pants sprite to the SpriteRenderer, the SpriteSkin will update its internal data and continue to work, as the Pants sprite was skinned to the same bones as the Leg sprite.

    If you want to change the sprite in the SpriteRenderer to a sprite with a different bone hierarchy, you should make sure that:
    - The hierarchy exists underneath the Root bone
    - The Auto Rebind checkbox is checked on the SpriteSkin component
     
  29. trapung

    trapung

    Joined:
    Jul 21, 2015
    Posts:
    8
    in your example, is only one renderer?
    you said 'Sprite Swap', i quess...

    but there should be two renderers for leg and pants,

    what i want to do ..
    upload_2022-6-22_17-53-42.png to upload_2022-6-22_17-54-53.png

    ( i.e) leg SpriteRenderer.sortingOrder = 0, pants SpriteRenderer.sortingOrder=1 )

    not sprite change or swap, but assembling of renderers.. on runtime


    Thank you for your kind and quick reply. :)
     
    Last edited: Jun 22, 2022
  30. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    413
    Maybe I misunderstand the bigger picture for your purposes but here but shouldn't the SAME bone should be used for both the pants AND the socks ?
     
  31. Upp000

    Upp000

    Joined:
    Mar 4, 2021
    Posts:
    52
    I notice that in skinning editor rig copy&paste, flip x doesn't work, bone rotation is wrong
     
  32. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    @trapung since you do not seem to want to set anything up in edit time, but rather set the Sprite Skins up in runtime, the current root bone constraint is not doing you any favours. I still don't understand why you give yourself the constraint of setting everything up in runtime, but it is good feedback to know that we have a few users who wishes to do this.

    For the time being, I would suggest you to explore other solutions to circumvent this limitation of Sprite Skin.
     
  33. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
  34. trapung

    trapung

    Joined:
    Jul 21, 2015
    Posts:
    8
    Thank you for your advice.

    I was able to do what I want on runtime with some makeshift ways.

    upload_2022-6-24_9-22-4.png

    In comparison with SkinnedMeshRenderer, I think that SpriteSkin is fascinating tool.
    Easy texture swap (sprite swap) and dynamic batching make me happy :)

    Great thanks!

    by the way, is there any grid snap option in Skinning Editor(edit bone and geometry) ?
    it's hard work to edit pixel assets.
     
  35. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    I'm happy that you managed to find a solution, and thank you for your kind words!

    We do not have any snapping functionality in the Skinning Editor, but I would love to know what kind of snapping functionality you would like to see, and what shortcut key you would use to enable this.
     
  36. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    69
    We are using Spine in our game, but suffering from performance troubles when there are more than 20 avatars on the screen.
    Because the spine doesn't support Burst and JobSystem, so we really appreciate what 2D animation supports and eagerly wanna replace the Spine with 2D animation.

    Only one reason stopped us: here is what I described in the previous post.

    So, please support that.

    Thanks
     
  37. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Thanks for the insights and additional poke for UGUI support, @suntabu.
    If you have the time, I would love to get some further insight into the specific issue you have with 2D Animation in a UI. Would you mind sharing some screen shots/demo project of what you are trying to achieve, in a private message to me? This would help me gauge what kind of support you are looking for.

    Thanks!
     
  38. trapung

    trapung

    Joined:
    Jul 21, 2015
    Posts:
    8
    Snapping vertices or bone positions to pixel unit.

    We already have 'Snap' option in Custom Outline or Custom Physical Shape mode in Sprite Editor.

    It would be better if we have half-pixel(0.5 pixel) snapping rather than just one pixel.
    With half-pixel snapping, we can put them to the center or corners of a pixel.
     
    Last edited: Jun 24, 2022
  39. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Got it, thanks for elaborating @trapung. I'll add this to our feedback list.
     
  40. PBKitty

    PBKitty

    Joined:
    Dec 23, 2021
    Posts:
    39
    Despite the downgrades to the sprite swap workflow in the recent versions of the package(a big thing stopping me from 'upgrading'), the actual functionality seems like it should be perfectly capable of the sorts of stuff that they do in that ANNO trailer. I'm guessing that they are actually scaling up their pixel art before skinning it, to get that kind of look, (That is, using higher resolution textures of chunky pixels) though you certainly can rig and animate 1:1 scale pixel art if you don't mind some rendering artifacts.
     
    EvOne likes this.
  41. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    904
    Can you expand a bit about the downgrade in sprite swap functionality? I haven't followed or used the tool so far, but I'm interested in simplifying the pipeline by switching from Spine to 2D Animation.
     
  42. PBKitty

    PBKitty

    Joined:
    Dec 23, 2021
    Posts:
    39
    As listed in the changelog(from 6.0):
    • Removed editing of Sprite Swap feature in Skinning Module
    • Updated Sprite Swap workflow focusing on Project Window and Inspector
    Basically, you could take layer groups created in your art software and convert them to swappable sprites automatically in the sprite editor. They removed that, so in 6.0+ versions you need to manually build your sprite library one item at a time in the project window and inspector which is a lot of pointless tedious work if you have a lot of swappable sprites and your artist(or you if you are the artist) already did the work of organizing and naming your layers.
     
    PanthenEye likes this.
  43. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    @PBKitty if you have the time, do give our new Sprite Library Editor a spin in Unity 2022.2 and let us know how it works for you. We added a few drag and drop functionalities to make the setup more streamlined, and a bigger workspace to more easily work with larger sets of Sprites.
     
  44. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    904
    Sounds like Animation 2D specific PSD import could use a tags system akin to what Spine has with its PhotoshopToSpine script. Add a [tag] in square brackets in the layer group's name and it'll pre process it upon import to whatever you need, such as placing multiple separate layers under the same parent for easy sprite swapping.

    Drag and drop workflows don't really address this when you have to do this at scale.
     
    PBKitty, EvOne and DragonCoder like this.
  45. Upp000

    Upp000

    Joined:
    Mar 4, 2021
    Posts:
    52
    I currently use preset. Save preset in the rigged psb file, and load the preset in new psb file, the process is very fast and easy, no need for spite library, please don't change this feature
     
    LilGames likes this.
  46. Upp000

    Upp000

    Joined:
    Mar 4, 2021
    Posts:
    52
    I like the current workflow, please focus on making the performance as fast as possible, because I need lots of avatars in the screen, I want a system that I can abuse, that is the most important thing
     
  47. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Thank you @PanthenEye for the feedback. To understand your needs better, could you elaborate on your process/pipeline? What scale are we talking about? Which steps in your process would benefit from batch setup/editing/iterating?
     
  48. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    793
    Thanks for chiming in @Upp000
    How does your use case look like, performance wise? And how does the current version of 2D Animation perform?
     
  49. PBKitty

    PBKitty

    Joined:
    Dec 23, 2021
    Posts:
    39
    Tried it, didn't like it.

    Actually, no, that isn't the right way to put it. I mean, there's nothing wrong with having that tool, but it is absolutely not a replacement for the removed functionality. It isn't the same as just being able to have everything set up in the art file and set up with a single click.

    As for the sprite resolver, it would be nice if there was the option to have an integer index of sprites instead of hashes. This would be particularly useful for situations where sprites represent a value and you want to animate that value over time. Currently I need to use a separate script to handle that sort of case, since trying to interpolate hashes... makes a hash of things.

    Bingo. It is a lot like if you told 3d devs that they'd now have to manually drag and drop skeleton bones into each imported mesh, or something equally absurd.

    I'm curious to hear more about how you're setting that up and using presets.
     
    Last edited: Jun 30, 2022
    EvOne likes this.
  50. Upp000

    Upp000

    Joined:
    Mar 4, 2021
    Posts:
    52
    i didn't set anything, the process is simple and straight forward, simply click the psb file that you have rigged, and in the top right corner of the inspector you can save preset, load the preset in your new psb file, the new psb file will be rigged.
    It might not work in run time but I am happy the way it is, because it is so fast and easy.
     
    Last edited: Jun 30, 2022