override public void OnInspectorGUI() { serializedObject.Update(); BoneComponent component = (BoneComponent)target; EditorGUILayout.PropertyField(skeletonComponent); if (component.skeletonComponent != null) { String[] bones = new String[component.skeletonComponent.skeleton.Data.Bones.Count + 1]; bones[0] = "<None>"; for (int i = 0; i < bones.Length - 1; i++) { bones[i + 1] = component.skeletonComponent.skeleton.Data.Bones[i].Name; } Array.Sort <String>(bones); int boneIndex = Math.Max(0, Array.IndexOf(bones, boneName.stringValue)); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Bone"); EditorGUIUtility.LookLikeControls(); boneIndex = EditorGUILayout.Popup(boneIndex, bones); EditorGUILayout.EndHorizontal(); boneName.stringValue = bones[boneIndex];; } if (serializedObject.ApplyModifiedProperties() || (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "UndoRedoPerformed") ) { component.bone = null; component.LateUpdate(); } }