Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Blend Shape missing in animation clip copied to new mesh

Discussion in 'Animation' started by syobe0808, Nov 2, 2021.

  1. syobe0808


    May 17, 2017
    I copied blend shape origin mesh to new mesh.
    It seems to copy completely as you can see below screenshot. But It's not working in animation.

    Mesh sourceMesh = _smRenderers[i].sharedMesh;
    Mesh targetMesh = smr.sharedMesh;
    Vector3[] deltaVertices = new Vector3[sourceMesh.vertexCount];
    Vector3[] deltaNormals = new Vector3[sourceMesh.vertexCount];
    Vector3[] deltaTangents = new Vector3[sourceMesh.vertexCount];
    for(int shapeIndex = 0; shapeIndex<sourceMesh.blendShapeCount; ++shapeIndex)
    string shapeName = sourceMesh.GetBlendShapeName(shapeIndex);
    if(targetMesh.GetBlendShapeIndex(shapeName) < 0)
    int frameCount = sourceMesh.GetBlendShapeFrameCount(shapeIndex);
    for(int frameIndex = 0; frameIndex<frameCount; frameIndex++)
    float frameWeight = sourceMesh.GetBlendShapeFrameWeight(shapeIndex, frameIndex);
    sourceMesh.GetBlendShapeFrameVertices(shapeIndex, frameIndex, deltaVertices, deltaNormals, deltaTangents);
    targetMesh.AddBlendShapeFrame(shapeName, frameWeight, deltaVertices, deltaNormals, deltaTangents);

    this is my copy code.
    (it refered

    So I check animation clip in animation window. Blend shape in animation clip is missing.
    I think link is broken during copy mesh to mesh. blendshape.jpg

    can Unity Technology guys help me ?
    Last edited: Nov 24, 2021