iOS crash while selecting text within an InputFied

Hello everyone.

Just having a consistent crash in iOS (iPhone) built with Unity 2019.3.9f1

Repro steps:

  • Tap on an InputField (Touchkeyboard shows up)
  • Type something
  • Try selecting the entire text or just a letter by touching/holding/dragging over the InputField

This is the crash message:

ArgumentOutOfRangeException: Selection is out of range.
Parameter name: selection
 at UnityEngine.TouchScreenKeyboard.set_selection (UnityEngine.RangeInt value) [0x00000] in <00000000000000000000000000000000>:0 
 at UnityEngine.UI.InputField.LateUpdate () [0x00000] in <00000000000000000000000000000000>:0 
UnityEngine.UnhandledExceptionHandler:PrintException(String, Exception)
UnityEngine.UnhandledExceptionHandler:HandleUnhandledException(Object, UnhandledExceptionEventArgs)
System.UnhandledExceptionEventHandler:Invoke(Object, UnhandledExceptionEventArgs)
 
(Filename: currently not available on il2cpp Line: -1)

I read about a similar crash while using TMP here:

https://issuetracker.unity3d.com/issues/textmeshpro-inputfield-throws-argumentoutofrangeexception-when-emptied-with-hide-mobile-input-enabled

But I’m using UnityEngine.UI.InputField and not TMP.

I am using the InputField property Hide Mobile Input = true

The crash only happens in an iOS device, not in the Editor

Any help would be useful, thanks!

I found a temporary solution after posting the comment earlier. The crash does not happen if the “Hide Mobile Input” property is set to false in the InputField’s inspector. An additional native input text shows up above the keyboard when this is set to false, but at least the crash does not happen. I tested it in Android, have not tested in iOS yet. I am settings all my input field’s Hide Mobile Input to false until the bug is fixed. Hope this helps.