top of page

Feb. 13th - Feb. 20th Emotion State for Model&Scriptable Object Method

In these two weeks, the piror task for me is to find out the way to set different facial expression as emotion for the head model. Bad news is that the emotional reponse method is not available yet from Convai, and I couldn't find the proper class in their script to set emtion value.

So that I need to find a new method which chould store the facial expression of model as its current emotion status, and could be changed like a button in UI, click different button to let the head have different facial expression. After some research and idea from our team discussion, I designed a method by using ScriptableObject and some scripts.

Here is the step:

  • First, using ScriptableObject to store value for different facial expression as prefabs in Unity

  • Second, find the proper Blendshape index, weight, and the Skinned Mesh Renderer to set up facial expression

  • Create a facial expression manager script, let the facial expression prefab could be called by other script

  • Create a UI trigger script, to call different facial expression by click button


In the first step, during the first test I realized some facial expression need different blendshape from different skinned mesh renderer, so that I need to define blendshape index, weight and the string <Name of Gameobject has skinned mesh renderer> so the final version of ScriptableObject is here named FaceExpression.

By this FaceExpression script, the face expression settings could be made into asset like below. Put the name of game object with skinned mesh renderer, its blendshpe index and weight. Currently, I set up 2 facial expressions:happy face and sad face.


This is the FaceExpressionManager script, and in the first test, the facial expression combined together when I click two botton in a order. So I added line for reset to default expression when calling the facial expression from one to the other.

This script is for UI botton, using UI botton as trigger to call the facial expression of the head.

In set up using the method of On Click() and type the name of the face expreesion defined by FaceExpression script.

From this method, I successfully set up the face expression for the head as its emotion and store it as prefabs which could be called if we need in project. Here is the video of it.


From this learning process, I learnt the method to store data for object and use it as prefabs and in other script. And this method is useful in many situation like quest progress or character status.


Next step

After combining all the part together, we might need more facial expression and different eye blink rate for different emotion state.

bottom of page