A 3D, on-screen keyboard that you can programmatically place in your scene.
// First, create a WebViewPrefab for our main web content. var mainWebContent = WebViewPrefab.Instantiate(0.6f, 0.3f); mainWebContent.transform.parent = transform; mainWebContent.transform.localPosition = new Vector3(0, 0f, 0.4f); mainWebContent.transform.LookAt(transform); mainWebContent.Initialized += (sender, e) => mainWebContent.WebView.LoadUrl("https://www.google.com"); // Add the keyboard under the main webview. var keyboard = Keyboard.Instantiate(); keyboard.transform.parent = mainWebContent.transform; keyboard.transform.localPosition = new Vector3(0, -0.31f, 0); keyboard.transform.localEulerAngles = new Vector3(0, 0, 0); // Hook up the keyboard so that characters are routed to the main webview. keyboard.InputReceived += (sender, e) => mainWebContent.WebView.HandleKeyboardInput(e.Value);
The keyboard supports layouts for the following languages and automatically sets the layout based on the operating system's default language:
void Init(float width, float height)
Initializes the keyboard with the specified width and height.
Instantiate() calls this method for you, so you only need to call this method directly if you place the
Keyboard.cs script on your own custom object.
static Keyboard Instantiate()
Creates and initializes an instance using the default width and height.
static Keyboard Instantiate(float width, float height)
Creates and initializes an instance using the specified width and height.
Indicates that the keyboard finished initializing.
Indicates that the user clicked a key on the keyboard.