public override void OnInspectorGUI() { serializedObject.Update(); MalbersEditor.DrawDescription("Dismember Limbs... To enable it, call the public methods for 'Dismember'"); EditorGUI.BeginChangeCheck(); { EditorGUILayout.BeginVertical(MalbersEditor.StyleGray); { MalbersEditor.DrawScript(script); list.DoLayoutList(); if (list.index != -1 && M.bodyParts.Count > list.index) { BodyPart item = M.bodyParts[list.index]; SerializedProperty Element = LimbList.GetArrayElementAtIndex(list.index); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.BeginHorizontal(); { EditorGUIUtility.labelWidth = 20; EditorGUILayout.LabelField(item.name, EditorStyles.boldLabel); EditorGUIUtility.labelWidth = 0; EditorGUI.BeginDisabledGroup(true); item.dismembered = GUILayout.Toggle(item.dismembered, new GUIContent(!item.dismembered ? "Not Used" : "Used", "This variable gets enabled when the limb is intantiated... that way the dismembering will be used one time"), EditorStyles.miniButton); EditorGUI.EndDisabledGroup(); if (M.bodyParts[list.index].member != null) { item.Instantiate = GUILayout.Toggle(item.Instantiate, new GUIContent("Instantiate", "if True the separated limb will be instantiated... else is already on scene and it will be enabled"), EditorStyles.miniButton); } } EditorGUILayout.EndHorizontal(); Limb member = M.bodyParts[list.index].member; EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(Element.FindPropertyRelative("AttachedLimb"), new GUIContent("Attached Limb", "The Attached limb on the Animal.. this gameobject will be hide after is dismemered"), true); if (member != null) //If theres a member on it { EditorGUILayout.PropertyField(Element.FindPropertyRelative("life"), new GUIContent("Destroy Limb", "Seconds before destroy the limb object"), true); if (Element.FindPropertyRelative("life").floatValue <= 0) { EditorGUILayout.HelpBox("Life <= 0 , the limb wont be destroy", MessageType.Warning); } } } EditorGUILayout.EndVertical(); if (member != null) //If theres a member on it { EditorGUILayout.BeginVertical(MalbersEditor.StyleGreen); EditorGUILayout.HelpBox("[Attached Bones] Bones on the animal \n[Dismember Bones] Bones on the Detached Limb\n\n The order of elements of both List must match", MessageType.None); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); MalbersEditor.Arrays(Element.FindPropertyRelative("AttachedLimbBones"), new GUIContent("Attached Bones", "Attached Limb Bones... They are use for alinging the Dismembered bones")); EditorGUILayout.EndVertical(); MemberScript = new SerializedObject(member); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUI.BeginDisabledGroup(true); MalbersEditor.Arrays(MemberScript.FindProperty("Bones"), new GUIContent("Dismember Bones", "The bones has to be on the same order than the Attached bones on the Dismember Script")); EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndVertical(); } EditorGUILayout.PropertyField(Element.FindPropertyRelative("OnDismember"), new GUIContent("On Dismember", "Invoked when Dismember is called"), true); } EditorGUILayout.EndVertical(); } } if (changer) { EditorGUILayout.BeginVertical(MalbersEditor.StyleGreen); { EditorGUILayout.HelpBox("This animal has [MaterialChanger] component.\nSet a Material-Item name to match the materials on the Dismembered Limbs ", MessageType.None); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.PropertyField(serializedObject.FindProperty("MaterialItemName"), new GUIContent("Material-Item", "The Current Material Item on the Animal to Update the Limbs Material Items")); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); } if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Dismember ChangeChanged"); //EditorUtility.SetDirty(target); } serializedObject.ApplyModifiedProperties(); }