BlendShapes with animations from Blender

I’m trying to understand how animations with BlendShapes work in Unity and Blender. I’m using Unity 5.1.1f1 and Blender 2.74.

I have a simple dancing cube with 1 animation and 2 BlendShapes. The BlendShapes are working well until I turn on the animator component. Then only the animation is played and the BlendShapes are completely ignored.

I have the following code controlling the cube.

using UnityEngine;
public class CubeController : MonoBehaviour {
    Animator animator;
    private SkinnedMeshRenderer skinnedMeshRenderer;
    private Mesh skinnedMesh;
    int blendShapeCount = 0;
    private MeshCollider meshCollider;
    [SerializeField] GameObject cube;
    [SerializeField][Range(0, 1)] float size;
    [SerializeField][Range(0, 1)] float deformation;
    void Awake()
        animator = GetComponent<Animator>();
        // Using BlendShapes
        skinnedMeshRenderer = cube.GetComponent<SkinnedMeshRenderer>();
        skinnedMesh = skinnedMeshRenderer.sharedMesh;
        meshCollider = GetComponent<MeshCollider>();
    // Use this for initialization
    void Start () {
        blendShapeCount = skinnedMesh.blendShapeCount;
        Debug.Log("blendshape count: " + blendShapeCount);
        if (blendShapeCount == 2)
            skinnedMeshRenderer.SetBlendShapeWeight(0, size * 100);
            skinnedMeshRenderer.SetBlendShapeWeight(1, deformation * 100);
        meshCollider.sharedMesh = skinnedMesh;

Here you have the exported dancing cube .fbx:
(broken link removed)

Are BlendShapes with animations supported?


I found the error.

I have the following structure with two GameObjects imported directly from Blender: blendShapeTest and chest2.


If you have the Blender Mesh named as Cube (default from Blender if you used a cube as a seed shape) then it doesn’t work. If you rename it to something else animations and BlendShapes work like a charm.