Search Issue Tracker
By Design
Votes
0
Found in [Package]
4.0.0-pre.2
Issue ID
TMPB-207
Regression
No
Printed text of the TextMeshPro input field is missing the last symbol and the length is one symbol longer
How to reproduce:
1. Open the user’s attached “testdatapersistence.zip” project
2. Enter Play Mode
3. In the input field insert “testing”
4. Observe the Console window
Expected result: “Name : testing : length 7” is printed
Actual result: “Name : testin : length 7” is printed
Reproducible with: 3.0.6, 3.2.0-pre.4 (2021.3.28f1), 4.0.0-pre.2 (2022.3.4f1, 2023.1.3f1, 2023.2.0a23)
Reproduced on: macOS 13.2.1 (Intel)
Notes:
If pressing the delete key when there’s no text in the input field then the printed length is 1
Not reproducible with legacy input field
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
- [OpenGLES][XR] Zooming in on the camera's URP opaque texture causes "double vision" on Quest in OpenGLES3
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
Resolution Note:
The "OnValueChanged" event for TextMeshPro InputField is triggered before the new value is fully processed.
The suggested workaround is to employ a one-frame-delay coroutine for operations that require the updated text:
public void CheckNameLength()
{
StartCoroutine(DelayedCheckNameLength());
}
private IEnumerator DelayedCheckNameLength()
{
yield return null; // wait for one frame
Debug.Log($"Name : {nameInputText.text} : length {nameInputText.text.Length}");
}
As for the length of the text, this is also expected as the TMP InputField appends the ZWS unicode to handle the cursor on new lines.