Monster shadow

VIDEO

2D animation in Unity - The PERFECT workflow

Description:
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
ADD A COMMENT

Radu Mazilu
You're incredible.
N
Might be unrelated but, what's the best app for making 2D assets, like Blender is for 3D?
MrMagicznyMAG
Man, you are new Brackey! I regret I didn't know this before!
sterling
the psb download is of another tutorial.. it is a skeleton
Tarodev
The one I used in the video is a paid asset, so I made a test psb with the same bone structure so you can follow along :)
Rainer Vieira
Awesome video, I'll definitely try this on my next project. By the way, are there any assets to sell with 2D bones animation (like for running, attacking, dying, etc) so I can hook my own sprites? I tried to look for it but I can only find 3D animation - I'm asking because I probably there is an animator somewhere with much better skills than me that can do a better job.
Rainer Vieira
@Tarodev alright, I guess I will have to try doing some animation myself then...
Tarodev
You know, I've never once looked for 2D animations... Strange. But let me just say: animating with 2d IK is VERY easy! I bet if you jump in you'll agree. What I've done in the past is find a nice running animation, record it and split it into frames, then import them into Unity. Stack them up and then just move the IK targets to match every 5th or so frame (don't do every frame, let unity interpolate for a smoother result). This is actually a great video idea! EDIT: I say it's easy because you only have to worry about the 4 IK targets for the most part... You can add additional flare to it by adjusting the head rotation etc.
Beard or Die
So good.
Tarodev
Beard
Deviken Games
your videos are amazing,please keep posting
Tarodev
I will keep posting, just for you Deviken!
Crætus
Dude, your videos are hidden gem. Thanks for videos!
Tarodev
Thanks mate ❤️
MadLibberator
As a non-photoshop user, I had to Google the difference between PSD and PSB, initially thinking one was just a typo. TIL: They're basically the same, whereas B stands for Big, and supports filesizes greater than 2GB. Nice video! Showing your workflow and shortcuts definitely help highlight areas where I can be more efficient in. Good stuff
Shane Curry Cartoons
Hey wait can you keyframe the sprite swapping? Like stack a series of mouths for lip sync? This is an awesome video btw!
Tarodev
You absolutely could! I don't show that in my next video, but I should certainly mention it. Great idea 💡
King Bling
BTW, when animating if you think that the animation is not looping perfectly or slows down a bit at the end making it uneven then you can select all extreme left and right keys then set them to "Flat" instead of "Clamped Auto" which is the default value.
Tarodev
That's an awesome tip!
King Bling
Holy sht that right clicking on Position and clicking "Add Key" was the best freaking advice, I used to drop down and search every child one after another that I wanted to animate before this. Freaking saves like probably a lot of time
NarkoPraxis
awesome video, thank you!!!
Bob
i followed a similar tutorial from someone else a while back where it took about 30 mins what you do (better) in 7. Great job!
Tarodev
Thanks! Glad you liked it.
Thedragonixxx
Neat and compact tutorial! :)
Ilja Daderko
Every vid you make is a gem! Thank you :)
CLEM-GAME
oh, very nice 👌
Soundy M.
Crackin’ bit of knowledge!!!!
Soundy M.
@Tarodev lmao! We’re going to need a bigger readMe :o
Tarodev
Add it to your ever growing encyclopedia, Soundy.
KRISZAB TUTOS
You are the Best! 💪💪
श्री Sojotaku
Naisu
SEE ALL COMMENTS


Transcript:

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