Hello, I have created an inventory system and most of it seems to be working fine. I just have one problem when i instantiate the item slot. The script on the slot object should enabled its image component and change its sprite to the item icon. It enabled and disables just fine but instead of loading the sprite it instead just loads a blank white square. I will post the script of the UIItem and the Itemclass where it stores the resource path. Code (CSharp): public void UpdateItem(Item item) { this.item = item; if(this.item != null) { spriteImage.enabled = true; spriteImage.sprite = this.item.icon; } else { spriteImage.enabled = false; } Code (CSharp): public class Item { public int id; public string type; public string title; public string description; public Sprite icon; public Dictionary<string,int> stats = new Dictionary<string,int>(); public Item(int id,string type, string title, string description, Dictionary<string,int> stats) { this.id = id; this.type = type; this.title = title; this.description = description; this.icon = Resources.Load<Sprite>("Sprite/Items/" + type + "/" + title); this.stats = stats; } public Item(Item item) { this.id = item.id; this.type = item.type; this.title = item.title; this.description = item.description; this.icon = Resources.Load<Sprite>("Sprites/Items/" + item.type + "/" + item.title); this.stats = item.stats; } }
PS: there are some functions inbetween that instantiate the slot prefab and create and store some Item Lists. But those should be fine i think since everything including some Debug.Logs work. Like i said it even enables/disables the right item slots after instantiating it just doesnt load the sprite. Also i included a screenshot of my resources folder.