JustPaste.it

public float animationSpeed = 0.2f;
public int blendShapeCount = 5; //Didn't find other way to get the count of the blend shapes. I am going to look again tomorrow
public SkinnedMeshRenderer meshRenderer;

int curFrame;
float frameLength;

void Update()
{
if (frameLength >= animationSpeed)
{
UpdateAnimationFrame();
frameLength = 0;
}
else
{
frameLength += Time.deltaTime;
}
}

void UpdateAnimationFrame()
{
meshRenderer.SetBlendShapeWeight(curFrame, 0);
curFrame++;
if (curFrame > blendShapeCount) Loop();
meshRenderer.SetBlendShapeWeight(curFrame, 100);
}
void Loop()
{
meshRenderer.SetBlendShapeWeight(curFrame - 1, 0);
curFrame = 0;
}