Search Unity

Resolved TouchScreenKeyboard why no events? Polling in Update is so terrible!

Discussion in 'XR Interaction Toolkit and Input' started by arkon, Oct 28, 2020.

Thread Status:
Not open for further replies.
  1. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    I've just had the misfortune of trying to implement the TouchScreenKeyboard in VR, Why and who is making these design decisions at Unity? It's like you don't have a Software Architect. I can't believe I've just had to poll the keyboard in Update to see if it's done. Also it doesn't seem to send the text changes anywhere.

    In short it needs text changed and done and on visible type events as a bare minimum.

    For anyone else struggling with this here is my update code:

    Code (CSharp):
    1.   void Update()
    2.     {
    3.         if (TouchScreenKeyboard.visible == false && overlayKeyboard != null)
    4.         {
    5.             if (overlayKeyboard.status == TouchScreenKeyboard.Status.Done)
    6.             {
    7.                 InputLabel.text = overlayKeyboard.text;
    8.                 //Text input done here
    9.                 overlayKeyboard = null;
    10.             }
    11.         }
    12.         else if (TouchScreenKeyboard.visible == true && overlayKeyboard != null)
    13.         {
    14.             InputLabel.text = overlayKeyboard.text;
    15.         }
    16.  
    17.     }
    18.  
     
  2. mfuad

    mfuad

    Unity Technologies

    Joined:
    Jun 12, 2018
    Posts:
    335
    TouchScreenKeyboard is an interface only supported on native iOS, Android, and UWP (mentioned in our documentation). It is not supported on VR platforms. Feel free to submit a feature request in the public roadmap of our XR Interaction Toolkit, and we will take it under consideration. Thanks!
     
Thread Status:
Not open for further replies.