February 3, 2020

⌨ InputKeyboard Prefab in Udon for VRChat

⌨ InputKeyboard Prefab in Udon for VRChat

OBSOLETE WARNING: VRCUiShape has now been fixed. Please disregard this post!!

LEAVING THIS HERE FOR ARCHIVE

After spending days making this prefab, someone posted that you could simply make normal InputFields work with the following Node in Udon...

Slightly annoyed about time waste, but at least I learnt something during this project, and this fix they presented will help the overall community! Looking forward to see what people will make now when we have functional typing and copy-paste again!

PLEASE DON'T USE THIS PREFAB ANYMORE




This is a drag-and-drop "Input Field" replacement Prefab for VRChat worlds while the VRCUiShape component is broken, rendering the traditional UI fields unusable.

Relevant issue report can be found here, please vote it up:
https://feedback.vrchat.com/vrchat-udon-closed-alpha-bugs/p/vrcuishape-does-not-function-in-game

📥 Download:

Download latest version
Download version 2020.02.03.18.34
Download version 2020.02.03.18.09
Download version 2020.02.03.16.46

Update 2020.02.03.18.09: Multiple bug fixes, such as deactivate callback not working, and the callback for "any" key executing every single update frame even when nothing is pressed.

Update 2020.02.03.18.34: Fixed maxLimiter not working.

✨ YouTube Setup Tutorial

YouTube tutorial on how to use this, as well as the Keypab prefab is coming as soon as I've gotten my new setup configured. Will probably be a couple of days.

📑 Instructions on Usage

This is an Advanced module. You will need to at least know how to make Udon graphs to have any use for this Prefab. Standalone use is useless.

To utilize this Prefab in your own Udon program, define your program as the target callback for any of the events you want to listen on. The settings and various callbacks are defined below.

To activate the keyboard ingame you simply click on it. The keyboard will try to intelligently adjust your height dynamically if you press Z or C, to make it easier to type. To exit the keyboard you simply press Escape.

⚠️ Note: This height adjustment feature has limited testing in VR-mode. If it causes nausia or other problems then a setting can be introduced to disable it for VR users. Please contact me if you have a VR headset and is able to test this!

⚠️ Note: As this is relying on the Input and KeyCode Unity-classes, features such as overlay keyboard or copy-pasting does not work! This is a security feature, as Udon programs does not have access to the users clipboard.

🍜🥧: This Prefab was written in UdonPie, which is a text-version of Udon. If interested you can check it out at https://github.com/zz-roba/UdonPieCompiler
The ability to code in text rather than graphs is a game changer, and drastically speeds up development. As UdonPie compiles straight to UAssembly, the original source code for this keyboard is included in the Prefab.


⚙️ Settings

Settings available for the InputKeyboard Prefab.

The Udon InputKeyboard featuers a lot of customizability via its settings. All callback settings are optional.

During all of the callbacks, a variable called "_keyboardCallbackBufferValue" is attempted to be set with the current input buffer to the target program. Use this value to get the current text of the input field during an event.


limitMaxLength - Decides if the input limiter should be on or off. If this is disabled then the player would be able to type b

maxLength - Defines the max length of accepted characters.

clearBufferOnEnter - If the input text should be cleared automatically when ENTER is pressed.

clearBufferOnSpace - If the input text should be cleared automatically when SPACEBAR is pressed.

clearBufferOnActivate - If the input text should be cleared automatically when the keyboard is activated.

callbackActivate - Triggers a custom event called "_keyboardActivateCallback" in the target program.

callbackDeactivate - Triggers a custom event called "_keyboardDeactivateCallback" in the target program.

callbackKeyAny - Triggers a custom event called "_keyboardKeyAnyCallback" in the target program when any key is pressed. This includes SPACEBAR and ENTER. If clearBufferOnEnter or clearBufferOnSpace is activated, then "buffer" will be empty, as this event is called last.

callbackKeySpace - Triggers a custom event called "_keyboardKeySpaceCallback" in the target program when SPACEBAR is pressed.

callbackKeyEnter - Triggers a custom event called "_keyboardKeyEnterCallback" in the target program when ENTER is pressed.

💙 Hope you enjoy it!

You are free to use this prefab without having to credit me. But if you do use it, I would love it if you sent a quick screenshot. It really gives motivation to continuously update and improve this, as well as continue making other stuff public. Thank you!