Search Issue Tracker
Fixed
Fixed in 6000.0.27f1, 6000.1.0a4, 7000.0.0a10
Votes
0
Found in
2021.3.42f1
2022.3.42f1
6000.0.15f1
7000.0.0a1
Issue ID
UUM-78397
Regression
No
[iOS] Crash on libsystem_platform.dylib`_platform_strlen when Hide Mobile Input is toggled and inputting emoji characters
How to reproduce:
1. Open the attached Project "EmojiErrorExample.zip"
2. Build and Run the Scene "SampleScene" on iOS
3. Select the Input Field "Without mobile input"
4. Enter emoji characters into the Input Field
5. Move the Caret between 2 emojis
6. Continue adding emojis
Reproducible with: 2021.3.42f1, 2022.3.42f1, 6000.0.15f1
Reproduced on:
- iPhone 7 Plus (iOS 14.6)
First lines of the Stack Trace:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x00000001eb845724 libsystem_platform.dylib`_platform_strlen + 4
frame #1: 0x000000010323e2ac UnityFramework`CreateCppStringFromNSString(NSString*) + 84
frame #2: 0x0000000103241660 UnityFramework`KeyboardOnScreen::GetText() const + 40
frame #3: 0x000000010274c508 UnityFramework`TouchScreenKeyboard_Get_Custom_PropText(void*, BindingsManagedSpan*) + 80
Notes:
- Not reproducible on Android
- The issue sometimes requires multiple emoji inputs to crash
- Another issue that can be observed is the Caret position being incorrect when attempting to move it after adding emojis, the offset increases with more emojis being added
-
nadav-kooply
Aug 26, 2024 06:34
I believe I found a fix for this issue. In TMP_InputField.cs you need to change the following lines in UpdateKeyboardStringPosition method:
From:
var selectionStart = Mathf.Min(caretSelectPositionInternal, caretPositionInternal);
var selectionLength = Mathf.Abs(caretSelectPositionInternal - caretPositionInternal);To:
var selectionStart = Mathf.Min(stringSelectPositionInternal, stringPositionInternal);
var selectionLength = Mathf.Abs(stringSelectPositionInternal - stringPositionInternal);This seems to fix the issue.
It also looks related to a similar issue with emojis on android:
https://issuetracker.unity3d.com/issues/android-writing-text-or-adding-more-emojis-after-an-emoji-in-the-inputfield-causes-the-first-emoji-to-disappear-and-be-changed-to-two-question-marks-when-hide-mobile-input-is-enabled-on-some-android-devices
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Inspector's custom tooltip is displayed incorrectly when the name is truncated in UI toolkit
- Crash on ScriptableRenderLoopDraw when rendering a specific VFX in Play Mode
- The script is not renamed in the Project window when renaming and a compilation Error is present
- Average FPS in Play Mode degradation on a newly created BiRP project when it's upgraded from 2020.3.48f1 to a newer Editor version
- DecoratorDrawer indentation is incorrect when it is called with EditorGUI
Resolution Note (fix version 7000.0.0a10):
Fixed issue with emojis in TextField on mobile.
Resolution Note (fix version 6000.1.0a4):
Fixed issue with emojis in TextField on mobile.
Resolution Note (fix version 6000.0.27f1):
Fixed issue with emojis in TextField on mobile.