facebook twitter hatena line email

「Unity/UniRx/TMPro」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(ページの作成:「==TMP_DropDownサンプル== <pre> using UnityEngine; using UnityEngine.UI; using UniRx; using TMPro; public class SampleScene : MonoBehaviour { void Start() {...」)
 
(TMP_DropDownサンプル)
行15: 行15:
 
                 var value = dropdown.options[index].text;
 
                 var value = dropdown.options[index].text;
 
                 text.text = value;
 
                 text.text = value;
             });
+
             })
 +
            .AddTo(gameObject);
 
     }
 
     }
 
}
 
}

2021年9月6日 (月) 17:41時点における版

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を作れば良い?

参考:https://github.com/neuecc/UniRx/issues/352