public void ChangePart(string part) { if (part == "null") { try { PartViewButtons.First(x => x.Name == target.GetInstalledPart(SelectedType)).Deselect(); } catch { } target.RemovePart(SelectedType); StatView.ShowValues(target); if (CalculatePrice() > 0) { BuyMenu.SetActive(true); PriceText.text = "$ " + CalculatePrice(); } else { BuyMenu.SetActive(false); } PartViewButtons.First(x => x.Name == "null").Select(); return; } try { PartViewButtons.First(x => x.Name == target.GetInstalledPart(SelectedType)).Deselect(); } catch { } PartViewButtons.First(x => x.Name == part).Select(); target.AttachPart(part); StatView.ShowValues(target); if (CalculatePrice() > 0) { BuyMenu.SetActive(true); PriceText.text = "$ " + CalculatePrice(); } else { BuyMenu.SetActive(false); } }