UI Image source image not changing

So I’m creating an inventory system for my game, and I’m having an issue with the image not updating.

So I have a class with a constructor

public Item(string slug)
	{
		this.Slug = slug;
		this.Sprite = Resources.Load<Sprite> ("Art/" + slug);
	}

and this function

public void AddItem (int id)
	{
		Item itemToAdd = database.getItemByID (id); //gets item from database
		for (int i = 0; i < items.Count; i++) 
		{
			if(items*.ID == -1)*
  •  	{*
    

_ items = itemToAdd;_
* GameObject itemObject = Instantiate(inventoryItem);*
_ itemObject.transform.SetParent(slots*.transform);
itemObject.GetComponent().sprite = itemToAdd.Sprite;
itemObject.transform.position = Vector2.zero;
break;
}
}
}*
But when I run and debug my game, the image is blank and has not loaded.
From what I have found it is an issue with the Image Source not loading the image and staying null, which means the this.Sprite = Resources.Load<Sprite> ("Art/" + slug); line is not working in the constructor.
Any help would be appreciated!_

Try relocating the “art” folder into “Resources”. You need to create this folder in Assets, If you don’t have one.

Also try avoiding “this”. Create a public Gameobject variable, and use it like this as in constructor.

public Gameobject mySprite;

public Item()
{
    mySprite = Resources.Load<Sprite> ("Art/" + slug);
}

Try this:

this.Sprite = Resources.Load<Sprite> ("Art/" + slug) as Sprite;

Edit:

Object [] slices;
slices = Resources.LoadAll ("YourSpriteSheet");
renderer.sprite = (Sprite)slices [3]; //So now i got 3rd slice from my sprite sheet.