public void Init(InventoryItem item) { txtName.text = item.WeaponConfig.Name; imgIcon.sprite = item.WeaponConfig.PreviewPicture; rectTransform = GetComponent <RectTransform>(); if (!item.UnlimitedAmmo) { imgAmmoIcon.sprite = item.WeaponConfig.Projectile.PreviewPicture; SetAmmo(item.Ammo); buyAmmoButton.Init(this, item); } else { imgAmmoIcon.enabled = false; buyAmmoButton.gameObject.SetActive(false); txtAmmoCount.text = ""; } txtDamage.text = item.WeaponConfig.Projectile.Damage.ToString(); buyButton.Init(this, item); inventoryItem = item; }