private void ConvertNodeTree(Transform bone, NullNodeTree nodeTree, Matrix4x4[] bindposes, Transform[] bones) { int index = GetBoneIndex(bones, bone); if (index == -1) { return; } nodeTree.SetNodeHandle(index); nodeTree.SetNodeName(bone.name); nodeTree.SetPosition(bindposes[index].GetColumn(3)); nodeTree.SetQuaternion(bindposes[index].rotation); int childCount = bone.childCount; for (int i = 0; i < childCount; ++i) { Transform child = bone.GetChild(i); NullNodeTree childNode = new NullNodeTree(); childNode.SetNodeHandle(-1); ConvertNodeTree(child, childNode, bindposes, bones); if (childNode.GetNodeHandle() != -1) { nodeTree.Children.Add(childNode); } } }