animationunity-game-engine2dsprite-sheet

Adding hats or skins to animated sprite in Unity


I am currently developing a 2D pixel art style platformer game in Unity. My main character is an ostrich, and I've made some running animation sprite sheets in a graphics editor. Now I want to be able to add some hats or glasses to the ostrich. The problem is that the ostrich head moves up and down in the animation, so I can't child a glasses or hat sprite and make it precisely follow the head. I have already tried animating the hat on it's own but it is firstly a lot of work, and secondly it smoothly transitions through the positions, hence not fitting to the sprite every frame.

To make myself clear, I want to make a sprite follow a certain position on a spritesheet animated character precisely to the pixel.

How could I achieve this?

Cheers,

Alex


Solution

  • Comment

    One option would be to animate the ostrich inside Unity, so that each body part you animate is it's own object. That way you could then add e.g. a hat as the child object of the head. But since you have already made pixel animations outside Unity, this is of course not an ideal solution. It also sounds a bit like this is what you mean with saying "child a glasses or hat sprite", but I wasn't sure if that was in the pixel part of it or not.

    Answer

    If you animate the head in Unity, that would make the animation for all things you then attach later on, hats, glasses etc.