Referencing individual Sprites on a SpriteSheet from C#?

I’ve been having some trouble with referencing individual sprites on a sheet from inside C# in Unity. I’m making an item database and two of the variables on the string that calls each item, are “ItemIcon”, a sprite, and “ItemIconHigh”, another sprite. One is just a highlighted version of the other, and they swap on mouseover.

Here’s the Item script as it exists.

public Item (string name, int id, int quality, string desc, int str, int end, int agi, int intel, int stack, Sprite icon, Sprite iconHigh, ItemType type)
	itemName = name; // A string
	itemID = id; // an Int
	itemQuality = quality; // an Int, 1 through 4 for different qualities
	itemDesc = desc; // a string
	itemStr = str; // an Int
	itemEnd = end; // an Int
	itemAgi = agi; // an Int
	itemIntel = intel; // an Int
	maxStack = stack; // an Int
	itemType = type; // an Enum,
	itemIcon = Resources.Load<Sprite>(type + "Slots" + id); // The non-working sprite reference line
	itemIconHigh = Resources.Load<Sprite>(type + "High" + id); // the other non-working line

“Slots” in this context refers to any item that isn’t highlighted. They have separate icons.

The icons are currently stored in Resources on sprite sheets. The sprites are named as they are called in the line above, but that doesn’t reference different sprites on any given sheet, and I’m not sure how to reference individual sprites on any given sheet. Here’s one that I’m trying to pull. This is a database entry.

items.Add(new Item("Agility Ore", 1, 1, "Ore", 0, 0, 0, 0, 10, "OreSlots[1]"(), "OreHigh[1]"() Item.ItemType.ORE));

So the line it would pull for that sprite’s name should be OreSlots1, which refers to a specific image on a specific sprite sheet. Ore is the item’s type, Slots is the generic name for a non-highlighted version of any sprite, and 1 is the item’s ID.

The spritesheets are named in the same format.

alt text

with 1, 2, 3, 4 etc referring to Item IDs.

Now, I know that the line

 itemIconHigh = Resources.Load<Sprite>(type + "High" + id);

is HILARIOUSLY wrong, and that the individual line in the database is also wrong.

I’m just not sure what I should be doing to pull a specific sprite from a sheet using a string, or using something other than LoadAll.

Should I just have a line at the top of either the item definition, or the database to just pull ALL of the sprites, and assign custom names to each 32x32 sprite on the sheet myself? Is what I’m trying to do not possible?

I’ve read other answers on this problem, but none of them reference pulling sprites from a sheet for individual entries, just all sprites as a whole from Resources.

I think this is the best you can do right now:

Having a gameobject referencing all sprites from one atlas and pack that into the resources folder