Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

2D Animation Preview Packages

Discussion in '2D Experimental Preview' started by rustum, Mar 14, 2018.

  1. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,478
    No I understand that I need to have each part on a layer. But why is it PSD support instead of PNGS? It makes sprite swapping even through code pretty much impossible right now...

    Anyway for now we will continue using spine by esoteric, but I am hoping that this becomes more widely usable sooner so that we can switch to it, I hate using external runtimes when I dont have to.

    EDIT: also when I tried to import the PSB using PSD importer, it flattened the image and gave me no way to unflatten it.

    What is the general process to getting a layered PSD in with parts correctly? I followed the guide but it just imports as a flat image with no way to determine what part is what
     
    EvOne likes this.
  2. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    153
    Yes, it flattens to a sprite atlas, since that's how game engines prefer 2D assets. You can still "access" the individual sprites, as with any sprite atlas, view the atlas or view it in "pose mode" as you should have had it in your PSD layers.

    Select the character gameObject (that the PSD importer creates) then in the inspector click Sprite Editor. your first view is "flattened" parts (the atlas), but select "Skinning Editor" from the upper left drop-down and you should see your character's layer parts in the exact same position as you had it in the PSD.

    The big question you are rightfully asking though is HOW to swap individual sprites. That's something many are asking for in other forum discussions about the new 2D Animation package
     
    GameDevCouple_I likes this.
  3. Thor_e

    Thor_e

    Joined:
    Sep 4, 2015
    Posts:
    23
    Hi,

    I have quite some experience with 2D skeletal animation, including the old-school way of just parenting with pivots. I also used Anima 2D and Puppet 2D.

    My Workflow & Setup
    Import from PSB is excellent. In the sprite sheet, I put all the sprites into a group called “Skin” and import them with the group option on. Then, I name the root bone “Skeleton” (the spine). Both of that goes under the actual agent Holder game object (which carries animator, colliders, most scripts). I also create a “Control” under the Holder, add the IK manager to the skeleton, and create limb solvers. I put them under this new “Control” object, delete each their childs and set each to be their respective targets.

    In result, the Holder has now three children: the Skeleton holds the bones and functionality, Skin holds the appearance and Control harbours the IKs, and is for animation, which I think is also the paradigm used.

    Problems & Inconsistencies
    I found it better to separate some parts of the characters that are better animated separately (like the face, where sprite swap animations make sense). Or parts that are “attached” and don’t need to be part of the core skeleton rig. I have these sprites on a separate sheet.

    1. Problem: Unfortunately, such “skin” objects need to be dropped into the skeleton hierarchy again, ruining the neat separation set up before.
    2. Problem: to rotate the head and to animate the body, I need to animate the skeleton bones directly, which also blurs the separation between skeleton and animation controls.

    Suggestions

    Both of these problems may have a similar solution, and perhaps this exists already (please, let me know!)
    1. Solution: a component that allows a game object to be 'hooked up' to a bone and treated AS IF it was its child. That way, additional sprites or bind/mount objects can be kept separate from the often intricate skeleton hierarchy.
    2. Solution: Puppet 2D has a "parent control" that imposes its position and rotation onto a target bone (intended for root bone), turning a game object into a control target similar to IK objects. So that you can animate this target object and the bone follows directly. Similar to that, an "orient control" that imposes only its rotation to the target bone, turning it into a knob to control a bone's rotation only. That way, targets can be animated consistently without dealing with the skeleton hierarchy.
    Root Rotation Problem
    The root bone, effectively the spine that starts from the hip and goes to the neck starts with a 90° rotation. Since this rotation is at the root, this caused some headaches with the stuff that effectively has to follow the bones (like the additional sprites). I solved this, but I would prefer if it was possible to zero out the root bone rotation, and not start the whole rig 90° rotated.

    Other than that, great system, so far easy to use, and the best I've tested so far, because of the good import and clean setup (as well as copy pasting) of the bones. /Sorry for the Wall of Text ;)
     
    EvOne likes this.