public void updateWeaponTexture(InventoryScript.WEAPON currentWeapon) { int index = (int)currentWeapon; Sprite weaponSprite = weaponSprites[index]; if (weaponSprite == null) { return; } if (currentWeapon == InventoryScript.WEAPON.noWeapon) { imageScript.changeColorAlpha(0.0f); imageScript.changeColorAlphaBackground(0.0f); } else { imageScript.changeColorAlpha(1.0f); imageScript.changeColorAlphaBackground(1.0f); } imageScript.updateSprite(weaponSprite); uiweapon = currentWeapon; }