Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

2D Animation v2 workflow with sprite swapping?

Discussion in '2D Experimental Preview' started by KhinRunite, Jan 14, 2020.

  1. KhinRunite

    KhinRunite

    Joined:
    Nov 18, 2013
    Posts:
    46
    Hi, so I've watched and read a dozen videos and tutorials on this, and I understand already how to set up a rig and animate with IK. My problem is that my character is more complicated than a "paper doll" these tutorials have. I have certain body parts that needs swapping due to a change in angle, or pose. Unfortunately I can't get my head around how to set it up.

    For visual reference, here is an image sequence. I have these as separate PSB files:
    spritesheet aether stand export.png spritesheet aether attack 1 p1 export.png spritesheet aether attack 1 p2 export.png spritesheet aether attack 1 p3 export.png

    As you can see, I could benefit from rigging due to the re-use of some body parts instead of redrawing each frame (also a character sprite is quite large).

    I have already set up rigs like so:
    aether unity sprite rig.png

    But I can't visualize how I would go about moving from Frame A to Frame B by moving just the bones and then changing the right arm sprites mid-animation. I don't know how to "link" bones across atlases.

    Can anyone help me? Thanks in advance!
     
    Stevepunk likes this.
  2. Sam_Ooi

    Sam_Ooi

    Unity Technologies

    Joined:
    Mar 5, 2018
    Posts:
    61
    Hi @KhinRunite , sounds like you would be able to achieve the effect by Sprite Swapping and swapping out the Sprites during the animation by animating the Sprite Resolver values. You can download a sample project showing an example of the animated swap by going to the 2D Animation Package in the Package Manager, and selecting Import for the Samples available.

    Then go to this folder: Assets > Samples > 2D Animation > 4.0.1 > Samples > 5 SpriteSwap

    Open the "1 Animated Swap.unity" Scene file. This shows an example animation that swaps the hand Sprites midway. You can then open the "dialog" and "dialog gray" Sprites (5 SpriteSwap > Sprites) in the Skinning Editor to see how they're arranged. For example both hand Sprites do use the same bones, but they're weighted differently, and one Sprite is not rendered while the other is.

    Do let me know if you would need any help with implementing the Sprite Swap aside from the sample projects.
     
    CubeGameStudio and Stevepunk like this.
  3. KhinRunite

    KhinRunite

    Joined:
    Nov 18, 2013
    Posts:
    46
    I tried Sprite Resolver but at first the parts are getting distorted when swapped. I think I understand better now. I've observed the following when I got it to work:
    1. Bone names must be retained across sprite sheets
    2. Bone influence must be in the same order as listed

    I think I will need to download Unity 2019.3 or newer because I see no "Samples" in the Package Manager. I'm currently on 2019.2 and 2D Animation preview 2.2. Thanks for the response!
     
  4. Sam_Ooi

    Sam_Ooi

    Unity Technologies

    Joined:
    Mar 5, 2018
    Posts:
    61
    Yes, 3.0.8 is the latest verified version of the 2D Animation package for 2019.3. Could you try downloading the latest 2019.3 version of the editor and upgrade to 3.0.8, and see if the Samples become available from the download in Packman?