• Editor
  • Starting help: Different character expressions

Related Discussions
...

Hello!
Im a beginner with using Spine, but havent managed to find a solution to this question yet (though it might be something simple I`m just not understanding). Skins are a bit of a mystery for me still, and I have been working with slots so far. I would really appreciate some advice!

The context is this:
I have a character , lets call them Warrior. The Warrior is supposed to have multiple different expressions. I have 3 different animations for the character: idle, walk and run. I have used slots to switch between different kinds of mouths, eyes, and eyebrows. for those animations.
The problem:
Can I use the same "blink" animation of the eyes for all 3 animations? Or do I need to animate the eyes to move for all of them separately? If I have t.ex a normal and happy expression, but I use the same eyes, I would like to use the same blink animation for them (but you can`t implement animations in slots?). Knowing this would be really helpful, since I will be adding a lot more animations and characters.

Thank you in advance!

Welcome to the Spine forum!

In your case, using skins would indeed be a good solution. Create expression skins and have them switch between expressions by switching skins in the game. That way you can use the same animation for all facial expressions.

Unfortunately, there are no suitable examples regarding facial expressions in the official example projects, so I created a simple example project:
FacialExpressionsExample.zip

If you download the zip file above and open the Spine project inside, you will see that the example skeleton has a very simple "blink" animation. Try to change the active skin while playing it and you will see that you can change the appearance of the skeleton while playing the same animation.
Also, I included a simple loop animation so that you can play the blink animation while simultaneously playing the other animations on the Preview view. Please refer to the video recording below for a brief overview of the project:

Hello! Thank you so much for the help!
Skins seem like the answer Im looking for. Im a bit worried will adding the expression parts as skins mix things up, if I add new characters as skins as well. Am I able to group them like "expression skins" and "character skins" ? All the characters would have different expression parts (they don`t use the same eyes t.example) .

Like this:
Character A has 3 different eyes , 3 mouths , 3 eyebrows , and they are as skins. Also idle, walk and run animation. I need to switch expressions on the different animations.

I will add character B , who should have the same idle, walk, and run animation as character A , but separate expressions.

The structure of the file is slightly confusing since there are so many separate parts, but this clears it up a bit already.
Thank you!
Eeva

In that case, there are various possible solutions.

The first is to use a naming rule such as characterA/eyes_Happy and characterB/eyes_Happy, so that while the characterA skin is applied, the combination of "characterA/" + "expression name" is used to change the facial expression of the character at runtime. (Just in case you didn't know, it is possible to apply multiple skins to a skeleton at the same time: Skins view - Spine User Guide)
Unfortunately, the Spine editor does not have that feature such as Skin sets so you can not switch between multiple skins at once, but it should be possible at runtime if the naming conventions are well defined.

The second is to use skins only for switching between characters’ appearance, and create animations for each facial expression. For example, creating a “blink” animation for each of Normal, Happy, and Sad expressions and play them back in the game as needed. This solution would be good if the number of facial expression animations were not so large.

The third is to use skins for switching facial expressions, and switch characters by making the texture size uniform for all characters and replacing the textures depending on what you want to display at runtime.
In the Spine editor, you can switch the skeleton's appearance by changing the image path in the Images node if the images for each character are placed into each character folder.
This takes a lot of time to first determine the standard texture size, but if you have a large number of facial expression parts and switching facial expression animations may be difficult, this may be a better option. If your characters are overall complex with a large number of attachments, I do not recommend this approach.

There was a similar question in the past, so the following post may be helpful:
Question about skins and animation export

Thank you so much!
The character designs are a bit complicated, and there are many of them, so it sounds like either the first or the second option of using skins only for switching between charactersappearance could be the solution. I currently have 6 different expressions for each character.
If one goes with the first option, would the naming convention be applied to the animations? And those applied by code , separate to skins? i´m not sure if I
m understanding correctly

If one goes with the first option, would the naming convention be applied to the animations? And those applied by code , separate to skins? i´m not sure if I`m understanding correctly

I’m afraid I couldn't understand what you mean by that, but I think you should check the runtimes documentation. For example, an example of code for combining multiple skins can be found in this section of the spine-unity runtime:
spine-unity Runtime Documentation: Combining Skins
I know that you may not necessarily use the spine-unity runtime, but since it is currently the one with the most extensive code examples, it would be helpful to understand what you can do with the Spine runtimes. Please note that the way the code is written varies a bit from runtime to runtime.

As shown in the code example, when you want to combine skins at runtime, you can create a new skin and add skins that you want to combine to it using the Skin addSkin method, then apply the combined skin to the skeleton.

Also, as described in the Runtime Repacking section, you can repack the textures to a single texture at runtime.

I recommend that you first create a simple test project and try to implement it. If you actually try to implement a character with skins and something goes wrong, don't hesitate to ask us.