Using Unity's amazing 2D stack (2D animation, PSD Importer, Sprite Swap), you can streamline your 2D workflow for a huge production boost to your development. We'll use IK (inverse kinematics) to assist us creating life like animations as well as setting up an easy way to swap sprites out, like weapons and armor. Not only that, we will reuse the same skeleton and animations across multiple units!
Example PSB: https://bit.ly/3v7xH6R
PSD to PSB: https://www.imageconvert.org/psd-to-psb
Please note: Check to ensure your layers all converted properly. You may need to flatten later styles.
Part 2: https://www.youtube.com/watch?v=wBGykdKd80w
🔔 SUBSCRIBE: https://bit.ly/3eqG1Z6
🗨️ DISCORD: https://discord.gg/GqeHHnhHpz
✅ MORE TUTORIALS: https://www.youtube.com/tarodev
by utilizing multiple official unity packages you can create powerful extensible 2d workflows for your game in this video you'll learn about psd importing 2d rigging inverse kinematics and the experimental sprite swap feature let's get into it before we begin confirm you have the required packages installed by going to window package manager ensuring the 2d animation and 2d psd importer are installed [Music] to prepare our unit spreads for importing in your favorite editing software order the layers how you'd like them to appear in unity for example i have my head above everything followed by the right arm torso etc by the way if you don't have anything to play with right now i've included a placeholder psb file in the description for you to follow along with as you can see i have multiple units in the same file organized in folders these units are similar so i should be able to make use of the same skeletal rig ensure you name each layer something unique for example don't call all your character heads head prefix them with the unit name [Music] now we're ready to save locate your unity project and save the file as a psb format this is similar to a psd but provides larger canvas sizes and is what unity expects to be imported if your editing software does not have the psp option you can convert your psd file into a psp using the converter i'll link down below hop over to unity and drag your new unit onto the scene my sprites are massive so i'll raise the pixels per unit to something more manageable [Music] click your psb file and enter the sprite editor from the drop down choose skinning editor click the visibility pane and untick the other units leaving just one click create bone and let's begin building our skeleton i usually give it a root bone at the base right click to stop bone chaining then left click on the root bone again to make it the parent bone now make the chest bone create the legs using the root as the parent bone and the arms using the chest as the parent bone if you can't see where you're trying to rig disable some elements from the visibility pane [Music] begin renaming your bones to something more self-explanatory [Music] remember to apply the changes once you're done with your bones click auto geometry then click generate for all visible doing this will instantly send your unit to mardi gras the colors represent what parts of the mesh are being controlled per each bone this audio gen is nice to start but let's fix up artifacts like this abomination click the bone influence menu and double-click on one of the sprite pieces it will display the bones affecting the sprat remove the bones not relevant to this piece for example i only want my head sprite to be affected by my head bone [Music] once you're happy with that unit hide it in the visibility pane and enable the next unit repeat the process apply changes and close the sprite editor as you can see all the sprites from both units have been flattened which is very messy click on your psb file and click the use layer grouping this will now represent your file accurately let's add some ik to our rig click your unit and add the ik manager 2d component add a new lim ik this creates a new object at the root of your unit let's call this the left arm solver create a new empty game object on the last bone of your left arm call this the left arm effector and move it to the very end of the bone click on the solver and drag the effector into the effector slot and click create target moving the target i can tell the arm is bending the wrong way so click the solver and click flip [Music] do this for the remaining limbs [Music] rename the solvers and targets to something a little nicer if you wish i also organize my solvers and targets into separate folders take note that the target does not need to be a child of the solver for animation we will only use the targets so it's nice to keep them all together you can change the limb colors to distinguish them a little better [Music] create a new prefab variant of your unit this way we're not saving changes to our base psp file [Music] let's give our unit a basic idle animation before we begin hot swapping our sprites in your animation pane click create this will make an animation controller and a new animation i named mine idle let's begin by keyframing our start pose select your four targets right click on the transform position and click add key i also added keys for the head rotation and the chest rotation and position copy all of the initial keyframes cycle forward a second or so and paste them in this will provide a clean animation loop a handy tip to create a nice looking animation is to click somewhere in the middle of the keyframes and lower your chest down a little bit due to the unit being rigged using ok the arms will stay in place creating a nice breathing effect give it some random variants by rotating the head slightly with an offset [Music] keyframe same goes for the arm targets and chest rotation [Music] the animation should be working nicely for all of your rigged units alright that's it for this video tune in for the next episode where we'll set up the new unity sprite swapping feature if you enjoyed the video make sure you subscribe and let me know what you thought down below