public void SetSlot(CraftData item, int quantity, bool selected = false) { if (item != null) { CraftData prev = this.item; int prevq = this.quantity; this.item = item; this.quantity = quantity; this.durability = 0f; icon.sprite = item.icon; icon.enabled = true; value.text = quantity.ToString(); value.enabled = quantity > 1; this.selected = selected; if (title != null) { title.enabled = selected; title.text = item.title; } if (default_icon != null) { default_icon.enabled = false; } if (dura != null) { dura.enabled = false; } if (filter != null) { filter.enabled = false; } if (prev != item || prevq != quantity) { AnimateGain(); } } else { this.item = null; this.quantity = 0; this.durability = 0f; icon.enabled = false; value.enabled = false; this.selected = false; if (dura != null) { dura.enabled = false; } if (filter != null) { filter.enabled = false; } if (title != null) { title.enabled = false; } if (default_icon != null) { default_icon.enabled = true; } } gameObject.SetActive(true); }