Unity/UniRx/TMPro
提供: 初心者エンジニアの簡易メモ
TMP_DropDownサンプル
using UnityEngine; using UnityEngine.UI; using UniRx; using TMPro; public class SampleScene : MonoBehaviour { void Start() { Text text = GameObject.Find("Text").GetComponent<Text>(); TMP_Dropdown tmpDropdown = GameObject.Find("TmpDropdown").GetComponent<TMP_Dropdown>(); tmpDropdown.ObserveEveryValueChanged(_ => _.value) .Subscribe(index => { var value = dropdown.options[index].text; text.text = value; }) .AddTo(gameObject); } }
UnityUIComponentExtensions.csへusing TMPro;が追加できない問題
別途、UnityUIExtensionsを作れば良い?