UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"add hover effect on text"
public class TextHover : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler { public Color hoverColor = Color.white; private Color defaultColor = Color.black; public void Start() { defaultColor = GetComponent<Text>().color; } public void OnPointerEnter(PointerEventData ed) { GetComponent<Text>().color = hoverColor; } public void OnPointerExit(PointerEventData ed) { GetComponent<Text>().color = defaultColor; } }