Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice
  3. Improve your project's performance with our new guide on profiling in Unity.
    Dismiss Notice
  4. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Help Wanted TouchScreenKeyboard.Open() not working after Asset API update

Discussion in 'VR' started by Smithurst, Jan 14, 2022.

  1. Smithurst


    Jul 8, 2020
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using TMPro;
    6. public class ShowKeyboard : MonoBehaviour
    7. {
    8.     private TouchScreenKeyboard overlayKeyboard;
    9.     private string inputText = "";
    10.     public GameObject inputBox;
    11.     // Start is called before the first frame update
    12.     void Start()
    13.     {
    14.         overlayKeyboard = TouchScreenKeyboard.Open("", TouchScreenKeyboardType.Default);
    15.     }
    17.     // Update is called once per frame
    18.     public void Update()
    19.     {
    20.         if(overlayKeyboard != null)
    21.         {
    22.             inputText = overlayKeyboard.text;
    23.             inputBox.GetComponent<TextMeshProUGUI>().text = inputText;
    24.         }
    25.     }
    26. }
    I have the OVR Manager script on my XRRig with the "Requires System Keyboard" checked and on my input field, I have the ShowKeyboard script - code can be seen above and an onSelect() on the input field calling the ShowKeyboard.Update().
    This is the code I used and it worked yesterday but since I did the Asset API Update today it will not show the keyboard in my VR environment. Can anyone help me either revert the Asset API update or help find a way for the code to work with the current update.