Adventure Creator Wikia
Advertisement

When lipsyncing or animating facial expression via blendshapes, AC only allows for one Shapeable component per character. This script allows you to synchronise blendshape values between two SkinnedMeshRenderer components, and can be adapted to work with multiple.

To use it, have two SkinnedMeshRenderers with the same set of blendshapes on each. Attach the script below and fill in the fields. Make sure that the model you are copying blendshapes to does not have a Shapeable component of its own, as this will intefere with it.

SyncBlendShapes.cs:

using UnityEngine;

public class SyncBlendshapes : MonoBehaviour
{

public SkinnedMeshRenderer meshToCopyFrom;
public SkinnedMeshRenderer meshToCopyTo;


private void LateUpdate ()
{
int numBlendshapes = meshToCopyFrom.sharedMesh.blendShapeCount;
for (int i=0; i<numBlendshapes; i++)
{
float shapeWeight = meshToCopyFrom.GetBlendShapeWeight (i);
meshToCopyTo.SetBlendShapeWeight (i, shapeWeight);
}
}

}
Advertisement