public void ResetButtonColors() { UIB_ScrollingMenu setupComp = null; foreach (UIB_ScrollingMenu uibsm in GetComponentsInParent <UIB_ScrollingMenu>()) { setupComp = uibsm; break; } //if there is an image, we don't want to affect the color of it. if (GetComponent <UnityEngine.UI.Button>().image.sprite != null) { GetComponent <UnityEngine.UI.Button>().image.color = new Color(255, 255, 255, 255); } if (buttonText != null) { buttonText.GetComponent <TextMeshProUGUI>().color = setupComp.TextColor.Value; } //SetDisplayedButton(); }
public void SetupButtonColors() { //Changes the color to white or green depending on the button type UIB_ScrollingMenu setupComp = null; foreach (UIB_ScrollingMenu uibsm in GetComponentsInParent <UIB_ScrollingMenu>()) { setupComp = uibsm; break; } if (setupComp == null) { return; } Color32 highlightColor = setupComp.TextHighlightColor.Value; if (GetComponent <UnityEngine.UI.Button>().image.sprite != null) { originalColor = GetComponent <UnityEngine.UI.Button>().image.color; } else { originalColor = setupComp.TextColor.Value; } if (buttonText != null) { // originalColor = buttonText.GetComponent<TextMeshProUGUI>().color; buttonText.GetComponent <TextMeshProUGUI>().color = highlightColor; } //The first button in the first menu is set to be green, regardless of mouse pointer //SetDisplayedButton(); }