Why kind of array or list should I use for multiple types of data?

I’m making a store page for my game, where the player can buy new options etc.

I made a prefab which contains blank spaces for:

  • a sprite
  • a label (for the price of the option)
  • another label (for the description of that option)

Basically each prefab will represent a page that you can scroll right or left, to display next item.

I want to build an array or list which contains the sprite (or a reference to it), an integer (for the price) and a string (for the description) and then I want to instantiate as many prefabs as needed and populate them with the data from my array/list.

How should I go about that?
Which type of array or list should I use?

Is there a better way to achieve that?

Thanks in advance

It is in my opinion best of all to create a class with your data, and then the array or the list from this class:

 public class myData {
  public Texture2D mySprite = null; //reference texture for your sprite
  publuc int price = 1000; //price your item
  public string desc = "This greate item";

 public myData[] myInv = null; //create your data in inspector

Or using list for your data. I hope it will help you.

You can create the list from any shared inheritance, or interface.

Worst case scenario you can always use


That will take anything.

However @zharik86 has the better answer for most applications.