void SpawnChildBoneSelected(object obj) { if (obj == null) { //add recursively foreach (var bone in utilityBone.bone.Children) { GameObject go = skeletonUtility.SpawnBoneRecursively(bone, utilityBone.transform, utilityBone.mode, utilityBone.position, utilityBone.rotation, utilityBone.scale); SkeletonUtilityBone[] newUtilityBones = go.GetComponentsInChildren <SkeletonUtilityBone>(); foreach (SkeletonUtilityBone utilBone in newUtilityBones) { SkeletonUtilityInspector.AttachIcon(utilBone); } } } else { Bone bone = (Bone)obj; GameObject go = skeletonUtility.SpawnBone(bone, utilityBone.transform, utilityBone.mode, utilityBone.position, utilityBone.rotation, utilityBone.scale); SkeletonUtilityInspector.AttachIcon(go.GetComponent <SkeletonUtilityBone>()); Selection.activeGameObject = go; EditorGUIUtility.PingObject(go); } }