UniTask
UniTask copied to clipboard
Add TMP_Dropdown extension
Added an extension to the Dropdown component of TextMeshPro.
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
using TMPro;
using UnityEngine;
namespace Sandboxes
{
public class Sandbox: MonoBehaviour
{
[SerializeField] private TMP_Dropdown _dropdown;
async UniTaskVoid Start()
{
// IAsyncValueChangedEventHandler
var changed = await _dropdown
.GetAsyncValueChangedEventHandler(destroyCancellationToken)
.OnValueChangedAsync();
Debug.Log($"Selected index: {changed}");
// IUniTaskAsyncEnumerable
_dropdown
.OnValueChangedAsAsyncEnumerable(destroyCancellationToken)
.Subscribe(x => { Debug.Log($"Selected index: {x}"); });
}
}
}
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.
I am writing to comment because the stale label was automatically assigned by GitHubActions. How about a PR here? You can close it if you don't need it.
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.
Keeping this PR active.