Skip to content

Conversation

TORISOUP
Copy link
Contributor

@TORISOUP TORISOUP commented Jan 6, 2025

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

Copy link
Contributor

github-actions bot commented Jul 6, 2025

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.

@github-actions github-actions bot added the stale label Jul 6, 2025
@TORISOUP TORISOUP force-pushed the add_dropdown_tmp branch from b02876e to 2c20cf1 Compare July 6, 2025 07:28
@TORISOUP
Copy link
Contributor Author

TORISOUP commented Jul 6, 2025

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.

@github-actions github-actions bot removed the stale label Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant