using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using TMPro; using UnityEngine; using UnityEngine.UI; public class CustomTMPDropdown : TMP_Dropdown { public string hideItemName; public void SetHideAndDeinteractableItems(string hideItemName) { this.hideItemName = hideItemName; } public override void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData) { base.OnPointerClick(eventData); StartCoroutine(SetHideAndDeinteractableDropdownItem()); } private IEnumerator SetHideAndDeinteractableDropdownItem() { yield return null; var dropdownList = GameObject.Find("Dropdown List"); if (dropdownList == null) yield break; var items = dropdownList.GetComponentsInChildren(true).ToList(); if (items.Count > 0) { var hideItem = items.Find(item => item.name.Contains(hideItemName)); hideItem.gameObject.SetActive(false); } } }