- Home /
Question by
cumulowinter · Mar 27, 2018 at 03:49 AM ·
uiprefabspriteinventory
Display Item Sprite on Inventory UI
I have an inventory system where when the item is picked up, it's destroyed, and when it's dropped, it spawns it's prefab. I would like to display the sprite (saved inside the prefab) of the item on a UI Image, but i don't know how to go about it
public void AddItem(string item)
{
if (sylladex [0] == null) {
sylladex [0] = item;
//Update UI somehow
slot [0].overrideSprite = slot [0].GetComponent<ItemManager> ().sprite;
}
}
this is the code i have for now, it doesn't really work, naturally
Comment
Answer by mugen-sosa · May 21, 2018 at 10:32 PM
maybe this can helps https://www.youtube.com/watch?v=VwE-Oo8Sn9A , isnt my.
Your answer
Follow this Question
Related Questions
Sprite poor quality 2D 2 Answers
Disfigured sprite after build. 0 Answers
New Gui 4.6 - How to use new GUI for inventory system 1 Answer
2D Lighting Material Overlap Issues 4 Answers
Unity 5 Asset Bundles - missing specific sprites from downloaded scene? 0 Answers