public void SwitchToWeapon(int index) { if (guns[weaponIndex]) { guns[weaponIndex].Switched(); guns[weaponIndex].gameObject.SetActive(false); } weaponIndex = index; shooting.SetWeaponHeld(guns[weaponIndex]); if (guns[weaponIndex]) { guns[weaponIndex].Switched(); guns[weaponIndex].gameObject.SetActive(true); UIManager.Instance.SetWeaponUI(guns[weaponIndex].name, guns[weaponIndex].GetProjectileLeft(), guns[weaponIndex].GetMagazineSize(), guns[weaponIndex].GetWeaponImage()); } }