facebook twitter hatena line email

「Unity/UniRx/モバイルキーボード取得」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(参考)
 
(同じ利用者による、間の5版が非表示)
行1: 行1:
(未完成:DebugTextに表示されず・・。失敗)
 
 
 
android端末にbluetoothキーボードで入力。
 
android端末にbluetoothキーボードで入力。
  
 
<pre>
 
<pre>
    private IObservable<TouchScreenKeyboard> touchScreenKeyboardOnDoneAsObservable;
+
private IObservable<TouchScreenKeyboard> touchScreenKeyboardOnDoneAsObservable;
    void Start()
+
void Start()
    {
+
{
        touchScreenKeyboardOnDoneAsObservable = Observable.EveryUpdate()
+
    touchScreenKeyboardOnDoneAsObservable = Observable.EveryUpdate()
            .Select(_ => TouchScreenKeyboard.Open("", TouchScreenKeyboardType.NamePhonePad, false, false, false))
+
        .Select(_ => TouchScreenKeyboard.Open("", TouchScreenKeyboardType.NamePhonePad, false, false, false))
            .Where(_ => _ != null)
+
        .Where(_ => _ != null)
            .Where(_ => TouchScreenKeyboard.isSupported)
+
        .Where(_ => TouchScreenKeyboard.isSupported);
            .Where(_ => _.status == TouchScreenKeyboard.Status.Done);
+
        // .Where(_ => _.status == TouchScreenKeyboard.Status.Done);
 +
        .AddTo(gameObject);
  
        touchScreenKeyboardOnDoneAsObservable
+
    touchScreenKeyboardOnDoneAsObservable
        .Subscribe(touchScreenKeyboard =>
+
    .Subscribe(touchScreenKeyboard =>
            GameObject.Find("DebugText").GetComponent<Text>().text = touchScreenKeyboard.text
+
        GameObject.Find("DebugText").GetComponent<Text>().text = touchScreenKeyboard.text
            // Debug.Log(touchScreenKeyboard.text)
+
        // Debug.Log(touchScreenKeyboard.text)
        )
+
    )
        .AddTo(gameObject);
+
    .AddTo(gameObject);
 
</pre>
 
</pre>
 
==参考==
 
==参考==
 
*https://gist.github.com/hecres/ed352abfa0c435ea6d0562a027551625
 
*https://gist.github.com/hecres/ed352abfa0c435ea6d0562a027551625
 
*https://develop.hateblo.jp/entry/unity-mobile-keyboad-input
 
*https://develop.hateblo.jp/entry/unity-mobile-keyboad-input
 +
*https://qiita.com/Gok/items/35329c717203e86774f0

2022年9月4日 (日) 16:11時点における最新版

android端末にbluetoothキーボードで入力。

private IObservable<TouchScreenKeyboard> touchScreenKeyboardOnDoneAsObservable;
void Start()
{
    touchScreenKeyboardOnDoneAsObservable = Observable.EveryUpdate()
        .Select(_ => TouchScreenKeyboard.Open("", TouchScreenKeyboardType.NamePhonePad, false, false, false))
        .Where(_ => _ != null)
        .Where(_ => TouchScreenKeyboard.isSupported);
        // .Where(_ => _.status == TouchScreenKeyboard.Status.Done);
        .AddTo(gameObject);

    touchScreenKeyboardOnDoneAsObservable
    .Subscribe(touchScreenKeyboard =>
        GameObject.Find("DebugText").GetComponent<Text>().text = touchScreenKeyboard.text
        // Debug.Log(touchScreenKeyboard.text)
    )
    .AddTo(gameObject);

参考