- Home /
How to fix faceplus MoreBlendshapeMeshes error in unity3d v4.6.1
I've been trying to make some facial animation with Mixamo faceplus v1.1.0.4 using this toturial (https://www.youtube.com/watch?v=JtcVl218CBE), but every time i start calibrating my character this error shows up:
ArgumentOutOfRangeException: Argument is out of range. Parameter name: index System.Collections.Generic.List`1[System.String].get_Item (Int32 index) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633) FacePlusExtras_MoreBlendshapeMeshes.FindCommonPrefix (System.Collections.Generic.List`1 stringList) (at Assets/Mixamo Face Plus/FacePlusExtras_MoreBlendshapeMeshes.cs:25) FacePlusExtras_MoreBlendshapeMeshes.Start () (at Assets/Mixamo Face Plus/FacePlusExtras_MoreBlendshapeMeshes.cs:51)
if !UNITY_4_2
string FindCommonPrefix(List<string> stringList){
bool stillValid = true;
string currentPrefix = "";
int checkIndex = 0;
while (stillValid){
if (checkIndex < stringList[0].Length){
string testPrefix = currentPrefix + stringList[0].Substring(checkIndex,1);
for(int i=0; i<stringList.Count; i++){
if (testPrefix != stringList[i].Substring (0,checkIndex+1)){
stillValid = false;
}
}
if (stillValid){
currentPrefix += stringList[0].Substring(checkIndex,1);
}
checkIndex++;
}
else{
stillValid = false;
}
}
return currentPrefix;
}
void Start () {
List<string> BlendshapeNameList = new List<string>();
indexMap = new List<List<int>>();
for(int i=0; i<FaceMesh.sharedMesh.blendShapeCount; i++) {
BlendshapeNameList.Add(FaceMesh.sharedMesh.GetBlendShapeName(i));
}
string BlendshapePrefixMain = FindCommonPrefix(BlendshapeNameList);
for(int i=0; i<ExtraBlendshapeMeshes.Count; i++){
indexMap.Add (new List<int>());
List<string> nameList = new List<string>();
for(int j=0; j<ExtraBlendshapeMeshes[i].sharedMesh.blendShapeCount; j++) {
nameList.Add ( ExtraBlendshapeMeshes[i].sharedMesh.GetBlendShapeName(j));
}
string shapesPrefix = FindCommonPrefix(nameList);
for(int j=0; j<nameList.Count; j++) {
for(int k=0; k<BlendshapeNameList.Count; k++) {
if(nameList[j].Remove(0,shapesPrefix.Length-1) == BlendshapeNameList[k].Remove(0,BlendshapePrefixMain.Length-1)){
indexMap[i].Add(k);
}
}
}
}
}
void LateUpdate () {
for(int i=0; i<indexMap.Count; i++){
for(int j=0; j<indexMap[i].Count; j++){
float curBlendshapeValue = FaceMesh.GetBlendShapeWeight (indexMap[i][j]);
ExtraBlendshapeMeshes[i].SetBlendShapeWeight (j, curBlendshapeValue);
}
}
}
endif
I am new to Unity, so could anyone help me with this problem?