ClientServer/Client/Assets/Scripts/UI/DropDownItemElement.cs
TG9six 03a642d635 first push
first push
2025-09-06 17:17:39 +04:00

23 lines
791 B
C#

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;
}