📱✖️ Unity TouchScreenKeyboard “Support” Is a Lie (On Desktop WebGL)

When working with Nova UI’s scrollable input fields in Unity 6, we hit a frustrating issue: TouchScreenKeyboard.isSupported was returning true on desktop platforms like Windows and macOS.

But the virtual keyboard never showed. Why? Because Unity defines “support” loosely — if a hardware keyboard is available, it returns true, even though a soft keyboard is never displayed.

đź’Ą The Symptom in NovaUI TextFieldMobileInput.InputLoop

if (touchScreenKeyboardController.Status != TouchScreenKeyboard.Status.Visible)

This check always failed — falsely assuming the keyboard was visible when it wasn’t, leading to unwanted focus loss or coroutine exits.

đź§  The Correct Fix

Don’t rely on TouchScreenKeyboard.isSupported alone. Combine it with Application.isMobilePlatform for a clean runtime check:

void Awake()
{
    if (!Application.isMobilePlatform)
    {
        Debug.Log("TextFieldMobileInput disabled on non-mobile platform.");
        this.enabled = false;
    }
}

Or if you want to patch the TextFieldMobileInput in NovaUI

protected override void OnEnable()
        {
            Debug.Log("TouchScreenKeyboard.isSupported: " + TouchScreenKeyboard.isSupported);
            if (!Application.isMobilePlatform || !TouchScreenKeyboard.isSupported)
            {
                Debug.Log("Disabling TextFieldMobileInput – not a mobile platform");
                enabled = false;
                // If touchscreen keyboard not supported on this device, do nothing
                return;
            }

            base.OnEnable();

            // Subscribe to selection changed so we can update the touch screen
            // keyboard whenever the input field selection changes
            inputField.OnTextSelectionChanged += UpdateTouchScreenKeyboardSelection;
        }

This avoids running mobile-only input code on platforms that don’t support it.

âś… Result

  • On Android/iOS: TextFieldMobileInput handles soft keyboard input
  • On desktop: TextFieldKeyboardInput takes over cleanly
  • No misleading keyboard checks, no wasted coroutines

đź§Ş Bonus Tip

You can even enforce this in Editor via a context menu or validation script to ensure the prefab doesn’t re-enable this component accidentally during testing.

đź§Ľ Final Thoughts

Unity’s platform quirks strike again — but with a one-line runtime guard, your Nova UI input fields can behave properly across platforms.

Nova UI scrollable input field with mobile keyboard logic guarded at runtime
Unity Nova UI: Guarding TouchScreenKeyboard logic at runtime on non-mobile platforms

Leave a Comment

Scroll to Top