private void EditSkills() { EditorGUILayout.Space(); EditorGUILayout.LabelField("Skills"); EditorGUILayout.LabelField("To give a skill a higher chance of being"); EditorGUILayout.LabelField("used add it in multiple times."); EditorGUILayout.Space(); SerializedObject skills = new SerializedObject(Selection.activeGameObject.GetComponent <EnemySkills>()); SerializedProperty skillList = skills.FindProperty("skillNames"); if (!SkillDatabase.isLoaded) { SkillDatabase.LoadSkills(); } int skillCount = skillList.arraySize; int deleteTarget = -1; for (int i = 0; i < skillCount; i++) { SerializedProperty currentSkillName = skillList.GetArrayElementAtIndex(i); SkillDescriptor currentSkill = SkillDatabase.GetSkill(currentSkillName.stringValue); GUILayout.BeginHorizontal(); GUILayout.Label(currentSkill.displayText); if (GUILayout.Button("Remove")) { deleteTarget = i; } GUILayout.EndHorizontal(); } if (deleteTarget > -1) { skillList.DeleteArrayElementAtIndex(deleteTarget); } //put all skills into a combo box for selection List <SkillDescriptor> allSkills = SkillDatabase.GetAllSkills(); string[] skillDisplay = new string[allSkills.Count]; for (int i = 0; i < allSkills.Count; i++) { skillDisplay[i] = allSkills[i].displayText; } GUILayout.BeginHorizontal(); currentSelectedPopUpSkill = EditorGUILayout.Popup(currentSelectedPopUpSkill, skillDisplay); if (GUILayout.Button("Add")) { int targetIndex = skillList.arraySize; skillList.InsertArrayElementAtIndex(targetIndex); SerializedProperty newSkill = skillList.GetArrayElementAtIndex(targetIndex); newSkill.stringValue = allSkills[currentSelectedPopUpSkill].name; } skills.ApplyModifiedProperties(); }