0
\$\begingroup\$

I want the character in my Unity 2D game to be able to change between many facial expressions (normal, happy, angry etc.), but I don't know the best way to do this. My character will be split into parts (Head, body, left & right arm and left & right leg) for animation purposes mainly. Should I make the head have no facial expression at first and then add another object with transparent background over it with the face and change the sprite or delete that object and instantiate another one? And also should all of these images be in the same large picture or should there be one face in every image file?

This image below is how the basic shapes looks at the moment (the graphics are not finished yet). And every shape has its own color. So the goal is to put a face (sprite) on the yellow head and be able to change that while the game story progresses.

enter image description here

Thanks in advance.

\$\endgroup\$
2
  • \$\begingroup\$ Can you show us what your character looks like? \$\endgroup\$
    – DMGregory
    Apr 10 at 1:02
  • \$\begingroup\$ The graphics are not done yet, but I have now included a preview of the shapes. \$\endgroup\$
    – christian
    Apr 10 at 5:52

1 Answer 1

1
\$\begingroup\$

Your proposal to make transparent sprites for facial expressions is a good one. You can have a sprite renderer for the face (or for each part of the face), and swap which sprite it displays using an animation timeline or a script.

It doesn't matter whether the different faces are all in separate images or all in one. Unity can automatically pack individual sprites together into a sprite atlas texture for efficiency as part of its build process, so that's an optimization you can always apply later, without needing to re-do your sprite work.

Or, if you're building your character as an animated 3D mesh rather than sprites, you can use the techniques the Asteroid Base devs demonstrate in this blog post / dev video.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .