I finally managed to have the user click on canvas input fields under visionOS. However, no keyboard shows up, so no text can be entered. Is there a way to popup the system keyboard on this platform somehow?
Text input via keyboard is targetted for the next 22 LTS Unity Editor release which should arrive soon. I’ll share back here once it’s available.
Keyboard should work in 2022.16.3f1 but the TMP package also needs an update, which I am not sure when that package update will get pushed.
However the changes to TMP package are very simple if you wanted to preemptively try it. In TMP_InputField.cs
you add RuntimePlatform.VisionOS
to the switch case statements right below RuntimePlatform.tvOS in the shouldHideSoftKeyboard
property and the isKeyboardUsingEvents
method.
Awesome, will try that. I guess I will have to copy the package and manually import it somehow, since it would be overridden by Package Manager?
Unfortunately, I can’t use 2022.16.3f1 right now, since it crashes the app on startup due to a bug in UnityWebRequest:
I patched UnityWebRequest as explained in the referenced thread and also patched TMP_Input.cs, by moving the package to /Packages and patching the file there, as explained here:
However, the keyboard still does not show up. Is there anything else I have to change?
Same here - no luck getting a keyboard to display
Anyone here who could get this work?
I just tried this now with a fresh build out of 2022.3.16f1 and it did work on the simulator.
This is the exact diff of TMP_InputField.cs that needs to happen:
+++ b/Projects/PolySpatialSamples/Packages/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_InputField.cs
@@ -420,6 +420,7 @@ public bool shouldHideSoftKeyboard
case RuntimePlatform.Android:
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.tvOS:
+ case RuntimePlatform.VisionOS:
case RuntimePlatform.WSAPlayerX86:
case RuntimePlatform.WSAPlayerX64:
case RuntimePlatform.WSAPlayerARM:
@@ -444,6 +445,7 @@ public bool shouldHideSoftKeyboard
case RuntimePlatform.Android:
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.tvOS:
+ case RuntimePlatform.VisionOS:
case RuntimePlatform.WSAPlayerX86:
case RuntimePlatform.WSAPlayerX64:
case RuntimePlatform.WSAPlayerARM:
@@ -477,6 +479,7 @@ private bool isKeyboardUsingEvents()
case RuntimePlatform.Android:
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.tvOS:
+ case RuntimePlatform.VisionOS:
#if UNITY_2020_2_OR_NEWER
case RuntimePlatform.PS4:
#if !(UNITY_2020_2_1 || UNITY_2020_2_2)
Also ensure you are doing ‘Replace’ on the XCode project when building it. All new changes from 2022.3.16f1 may not get added through ‘Append’.
We’re using TextMeshPro 3.2.0-pre.4 and have tested this diff on device without any luck. Could there be something else we need in this version? (we need pre.4 to enable diacritical mark support for Thai text rendering)
I noticed there is a similar platform switch in public bool shouldHideMobileInput
and have tried builds with and without visionOS added to those switches.
Thanks,
Joe
Actually, good news, the back port to 2022.3.16f1 did get released before break:
https://docs.unity3d.com/Packages/com.unity.textmeshpro@3.2/changelog/CHANGELOG.html
3.2.0-pre.7 is the TMP version with these changes.
You can add this in the package manager by clicking the + in the upper left, choosing ‘Add Package By Name’, then inputting com.unity.textmeshpro
for the name and 3.2.0-pre.7
for the version.
shouldHideMobileInput
is not currently applicable to VisionOS. It refers to the input field above the iOS system keyboard, which VisionOS unfortunately currently can’t support.
Thanks! trying now
No luck on pre.7. I get the caret, but no keyboard appears (on device). Have tried with Unity 2022.3.16 and .17
No dice in simulator either. Will debug in Xcode
I cannot seem to get TMP InputFields to work at all? Which camera are you setting for the World Canvas? Is there a trick to this?
Had assumed new UI Input Text prefabs will soon be provided
I’m uploading my sample project here if anyone wants to/could take a look. Debugging in Xcode shows the code TouchScreen.Open is called but no keyboard appears.
Unity 2022.3.17
PolySpatial 0.7.1
TextMeshPro 3.2.0-pre.7 with no modifications
is there supposed to be a special prefab for visionOS Input Field?
We also tried following @ RyanGoodrichUnity’s advice.
Unity 2022.3.17
PolySpatial 0.7.1
TextMeshPro 3.2.0-pre.7 with no modifications
The TMPro InputField highlights, but does not accept bluetooth keyboard input. It also doesn’t open an OS keyboard. It doesn’t work on the sim or on a device. Our setup was an InputField within a scaled down canvas.
We’re starting to worry we might not be able to release on time if this won’t be resolved soon.
likewise… input field text is a very basic UI feature that needs to be supported.
My apologies, there is a change in the PolySpatial package itself that is still making its way through the pipe to release, that last changes needed will be in the polyspatial 0.8.0 package.
Thanks! Is there a workaround we can apply to the package for now?