Так как на вопрос много подписанных изображу текущее решение:
public class Item
{
public int id;
public int cost;
public string name;
public Sprite performance;
public Sprite icon;
public Item(int _cost, string _name, Sprite _perfomance, Sprite _icon){
id = ++id;
cost = _cost;
name = _name;
performance = _perfomance;
icon = _icon;
}
}
public class Weapon : Item
{
public int damage;
public int distance;
public Weapon (int _damage, int _distance, int _cost, string _name, Sprite _perfomance, Sprite _icon):base(_cost, _name, _perfomance,_icon)
{
damage = _damage;
distance = _distance;
}
}
public class Sword : Weapon
{
public Sword (int _damage, int _distance, int _cost, string _name, Sprite _perfomance, Sprite _icon):base(_damage,_distance, _cost, _name, _perfomance, _icon)
{
}
}
public Sprite GetSprite(string _name){
Sprite[] textures = Resources.LoadAll<Sprite>("Weapon/Swords");
string[] names = new string[textures.Length];
for(int ii=0; ii< names.Length; ii++) {
names[ii] = textures[ii].name;
}
Sprite sprite = textures[Array.IndexOf(names, _name)];
return sprite;
}
void Start()//для проверки
{
item_L.Add (new Weapon (10, 1, 111, "noobsword" , GetSprite ("noobsword"), GetSprite ("noobsword")));
item_L.Add (new Weapon (10, 1, 111, "epicsword" , GetSprite ("epicsword"), GetSprite ("epicsword")));
}
А для отображения:
i.transform.FindChild("Text").GetComponent<Text>().text = currentItem.name;
i.GetComponent<Image>().sprite = currentItem.icon;
Может есть лучше варианты, но пока самый понятный.