public void SaveItem() { string name = transform.Find("nameInput").GetComponent <InputField>().text; string iconName = transform.Find("iconNameInput").GetComponent <InputField>().text; string itemType = transform.Find("itemTypeInput").GetComponent <InputField>().text; int attack, health, defence, rotation, speed, visibility, cannonReloadSpeed, critChance; Int32.TryParse(transform.Find("attackInput").GetComponent <InputField>().text, out attack); Int32.TryParse(transform.Find("healthInput").GetComponent <InputField>().text, out health); Int32.TryParse(transform.Find("defenceInput").GetComponent <InputField>().text, out defence); Int32.TryParse(transform.Find("rotationInput").GetComponent <InputField>().text, out rotation); Int32.TryParse(transform.Find("speedInput").GetComponent <InputField>().text, out speed); Int32.TryParse(transform.Find("visibilityInput").GetComponent <InputField>().text, out visibility); Int32.TryParse(transform.Find("cannonReloadSpeedInput").GetComponent <InputField>().text, out cannonReloadSpeed); Int32.TryParse(transform.Find("critChanceInput").GetComponent <InputField>().text, out critChance); Mysql mysql = FindObjectOfType <Mysql>(); Item it = new Item(); it.name = name; it.iconName = iconName; it.item_type = itemType; it.attack = attack; it.health = health; it.defence = defence; it.rotation = rotation; it.speed = speed; it.visibility = visibility; it.cannon_reload_speed = cannonReloadSpeed; it.crit_chance = critChance; if (item != null) { it.item_id = item.item_id; } if (item == null) { mysql.AddItem(it); } else { mysql.EditItem(it); } item = null; transform.gameObject.SetActive(false); ItemsTable script = itemsTable.GetComponent <ItemsTable>(); script.Reload(); }