private Color[] CalculateVertexColors(Transform[] bones, Mesh m, Bone bone) { Color[] colors = new Color[m.vertexCount]; for (int i = 0; i < colors.Length; i++) { colors[i] = Color.black; } if (bones.Any(b => b.gameObject.GetInstanceID() == bone.gameObject.GetInstanceID())) { for (int i = 0; i < colors.Length; i++) { float value = 0; BoneWeight bw = m.boneWeights[i]; if (bw.boneIndex0 == bone.index) value = bw.weight0; else if (bw.boneIndex1 == bone.index) value = bw.weight1; else if (bw.boneIndex2 == bone.index) value = bw.weight2; else if (bw.boneIndex3 == bone.index) value = bw.weight3; colors[i] = Util.HSBColor.ToColor(new Util.HSBColor(0.7f - value, 1.0f, 0.5f)); } } return colors; }