using UnityEngine; using UnityEngine.EventSystems; using TMPro; //thomas09 //this script is attached to the Dropdown prefab in Content > Prefabs > UI > Dropdown //it is attached to the "Item" object under template. public class DropDownItemElement : MonoBehaviour, ISelectHandler, IDeselectHandler, IPointerEnterHandler, IPointerExitHandler { [SerializeField] private TMP_Text itemText; public void OnPointerEnter(PointerEventData eventData) => OnEnter(); public void OnSelect(BaseEventData eventData) => OnEnter(); public void OnPointerExit(PointerEventData eventData) => OnExit(); public void OnDeselect(BaseEventData eventData) => OnExit(); private void OnEnter() => itemText.color = Color.black; private void OnExit() => itemText.color = Color.white; }