public void SubmitChanges() { if (!edit) { return; } Character currentCharacter = SelectedCharacter(); if (currentCharacter == null) { return; } try { currentCharacter.Name = Name.text; currentCharacter.MaxHP = Int32.Parse(MaxHP.text); currentCharacter.Speed = Int32.Parse(Speed.text); currentCharacter.SetExperience(Int32.Parse(Experience.text)); if (Abilities != null) { InputRow[] abilityRows = Abilities.GetAllRows(); foreach (InputRow row in abilityRows) { string ability = row.RowElements[0].GetComponent <Text>().text; currentCharacter.SetAbilityScore(ability, Int32.Parse(row.RowElements[1].GetComponent <InputField>().text)); currentCharacter.SetProficiency(ability, row.RowElements[2].GetComponent <Toggle>().isOn); } } if (Skills != null) { InputRow[] skillRows = Skills.GetAllRows(); foreach (InputRow row in skillRows) { string Skill = row.RowElements[0].GetComponent <Text>().text; currentCharacter.SetSkillType(Skill, row.RowElements[1].GetComponent <InputField>().text); currentCharacter.SetProficiency(Skill, row.RowElements[2].GetComponent <Toggle>().isOn); } } if (Modifiers != null) { InputRow[] modifierRows = Modifiers.GetAllRows(); currentCharacter.Modifiers.Clear(); foreach (InputRow row in modifierRows) { Modifier newMod = new Modifier( row.RowElements[0].GetComponent <InputField>().text, row.RowElements[1].GetComponent <InputField>().text, (Expression)row.RowElements[3].GetComponent <InputField>().text, (Expression)row.RowElements[4].GetComponent <InputField>().text ); newMod.Active = row.RowElements[2].GetComponent <Toggle>().isOn; currentCharacter.Modifiers.Add(newMod); } } } catch (Exception e) { Debug.LogError(e.Message); } if (Target != null) { Target.RefreshInfo(); } GameManager.windowManager.CharacterManager.UpdateAll(); }