public void PickUpWeapon() { for (int i = 0; i < inventory.weapons.Count; ++i) { if (inventory.weapons[i].sprite == null) { inventoryUI.GetChild(i).GetComponent <Image>().color = new Color(1.0f, 1.0f, 1.0f, 1.0f); var getWeapon = weaponData.GetWeapon(); inventoryUI.GetChild(i).GetComponent <Image>().sprite = getWeapon.sprite; inventory.weapons[i] = getWeapon; if (!equip.isEquipped) { equip.EquipWeapon(inventory.weapons[i]); } else { audioSource.clip = audioClip; audioSource.Play(); } break; } } setMessage.SetMessage("You have picked up weapon"); ResetData(); }