//Find matching bones in character model
    private void MatchBones(ModelRenderer modelRenderer)
    {
        renderer = mesh.GetComponentInChildren <SkinnedMeshRenderer>();
        SkinnedMeshRenderer   renderer2 = modelRenderer.GetComponentInChildren <SkinnedMeshRenderer>();
        Dictionary <int, int> boneMap   = new Dictionary <int, int>();

        for (int i = 0, j = 0; i < Model.Skeleton.Bones.Length; i++, j++)
        {
            if (Model.Skeleton.Bones[i].Name == modelRenderer.Model.Skeleton.Bones[j].Name)
            {
                boneMap.Add(i, j);
            }
            else
            {
                i--;
            }
        }
        Transform[] bones = new Transform[boneMap.Count];
        Matrix4x4[] bind  = new Matrix4x4[boneMap.Count];
        for (int i = 0; i < bones.Length; i++)
        {
            bones[i] = renderer2.bones[boneMap[i]];
            bind[i]  = renderer2.sharedMesh.bindposes[boneMap[i]];
        }
        renderer.bones                = bones;
        renderer.rootBone             = renderer2.rootBone;
        renderer.sharedMesh.bindposes = bind;
    }