How can i change a Sprite "Variable".

I need to change the Variable Sprite beacause i need to make an invetory system. And is sooooo deficent to make a Sprite Variable for every image (Because it Will have a lot), somebody know how to change it to make load another Sprite?

{
Image Imagen;
public Sprite Sprite;
public string Objeto; //Object
public int slot;
void Start()
{
Imagen = GetComponent<Image>();
}
void Update()
{
	if (Objeto == "ESPADA"){  //Sword
		//<----- Load sword Sprite here
	 Imagen.sprite = Sprite;
	}
	else if (Objeto == "Arco"){
	//<----- Load bow Sprite here
	Objeto = "Arco";
	Debug.Log ("Objeto Invalido");
	}
}

Try:

  • Create a “Resources” in your “Assets” folder

  • Put your sprites inside your Resources folder

  • Load your file with Sprite sp = Resources.Load("file_name") as Sprite; where file_name is the file WITHOUT EXTENSION inside your Resources folder.

Adapting it to your code would give:

Image Imagen;
 public Sprite Sprite;
 public string Objeto; //Object
 public int slot;
 void Start()
 {
 Imagen = GetComponent();
 }
 void Update()
 {
     if (Objeto == "ESPADA"){  //Sword
         Sprite sp = Resources.Load("espada") as Sprite;
         Imagen.sprite = sp;
     }
     else if (Objeto == "Arco"){
         Sprite sp = Resources.Load("arco") as Sprite;
         Imagen.sprite = sp;
     }
 }

Hope it helped (sorry for the formatting. if someone could help, it would be great)