Hey Unity Community,
I’ve been toying about with Unity for a little over a week trying to make a 2D swordfighting “prototype”.
I’ve hit a snag when it comes to animating the character though, when it comes to the character rotating or turning.
My little character guy here is made of various sprites parented and childed together so he sort of works like a puppet. I semi-achieved what I wanted in one of the animations as follows:
At the start of the animation I start scaling the shield to make it more “flat”. After that I deactivate the shield gameobject and activate a second shield gameobject which has a different sorting layer and sprite. The result is that it looks like he turns his shield to face forward. This was all done within an animation.
Now I am curious how I could do this with more complex animations, such as the character swinging his sword in a horizontal motion, or the character turning to face the camera. I noticed it’s possible to change which sprite is rendered during animation but I can’t change the sorting layer. As an example, if the character turned to face the camera and I made his “background” arm stretch across his chest it would be drawn behind his torso…
So… do I really have to create a whole series of second gameobjects with alternative sprites and swap them in and out during the animation process? It seems like this would be a very inefficient way of doing things that could undoubtedly be solved in a more practical manner.
Any information, advice, tips, links or tutorials would be most appreciated.