private void ChangeItemButtonColor(BagItem button) { if (BagItemRoot.transform.childCount == 0) { return; } var colorBlock = BagItemRoot.transform.GetComponentInChildren <Button>().colors; colorBlock.normalColor = new Color(255 / 255f, 255 / 255f, 255 / 255f, 255 / 255f); colorBlock.highlightedColor = new Color(245 / 255f, 245 / 255f, 245 / 255f, 255 / 255f); colorBlock.selectedColor = new Color(245 / 255f, 245 / 255f, 245 / 255f, 255 / 255f); foreach (Transform item in BagItemRoot.transform) { item.GetComponent <Button>().colors = colorBlock; } colorBlock.normalColor = new Color(0, 101 / 255f, 195 / 255f, 255 / 255f); colorBlock.highlightedColor = new Color(101 / 255f, 195 / 255f, 255 / 255f, 255 / 255f); colorBlock.selectedColor = new Color(101 / 255f, 195 / 255f, 255 / 255f, 255 / 255f); button.GetComponent <Button>().colors = colorBlock; }