public bool FindHead(Transform root, out Transform headBone) { Transform transforms; if (this.providedHeadBoneName) { Transform transforms1 = root.Find(this.headBoneName); transforms = transforms1; headBone = transforms1; return(transforms); } if (!this.providedHeadBone || !this.headBone) { headBone = root; return(false); } StringBuilder stringBuilder = new StringBuilder(); RagdollTransferInfo.FindNameRecurse(this.headBone, stringBuilder); Transform transforms2 = root.Find(stringBuilder.ToString()); transforms = transforms2; headBone = transforms2; return(transforms); }
private static void FindNameRecurse(Transform child, StringBuilder sb) { Transform transforms = child.parent; if (transforms) { RagdollTransferInfo.FindNameRecurse(transforms, sb); if (sb.Length <= 0) { sb.Append(child.name); } else { sb.Append('/'); } } }