Search Issue Tracker

Fixed

Fixed in 2021.3.0f1, 2022.3.0f1

Votes

11

Found in

2021.3.31f1

2022.3.12f1

Issue ID

UUM-37282

Regression

Yes

[Android] TMP_InputField throws an exception upon Submit

--

-

see: https://unity.slack.com/archives/C06TQC5TK/p1685380002972049

 

Editing a textfield on Android and then submitting throws an exception.

Steps:
1. Create a scene with a Canvas
2. Add a TMPro Input field
3. Run the app on an Android device
4. Once the app is running on the device, focus the input field and enter some text
5. Submit

A quick investigation shows that eventData is null when TMP_InputField.OnSubmit is called.
Here is the stack

/Unity: NullReferenceException: Object reference not set to an instance of an object.
at TMPro.TMP_InputField.OnSubmit (UnityEngine.EventSystems.BaseEventData eventData) [0x0003f] in ./Library/PackageCache/com.unity.ugui@2.0.0/Runtime/TMP/TMP_InputField.cs:4438
at TMPro.TMP_InputField.LateUpdate () [0x002cb] in ./Library/PackageCache/com.unity.ugui@2.0.0/Runtime/TMP/TMP_InputField.cs:1747

  1. Resolution Note (fix version 2022.3.0f1):

    Fixed editing a textfield on mobile and then submitting throws an exception. Fixed in 3.2.0-pre.7

  2. Resolution Note (fix version 2021.3.0f1):

    Fixed editing a textfield on mobile and then submitting throws an exception (3.2.0-pre.7)

Comments (3)

  1. thiagolrosa

    Dec 08, 2023 11:51

    I have a small game and it has thousands crashes. A big game is probably having millions of these crashes and they are still "under consideration", this is ridiculous...

  2. MaskedMouse

    Nov 27, 2023 14:11

    TMPro 3.2.0-pre.6 has this issue as well.
    It's a little bit stupid that OnSubmit is calling the Use() method of the eventData without checking whether the eventData is null.
    There are multiple places where OnSubmit is being called with null.
    Simple fix is to null check.

    Does Unity not have possible null reference analysis on their code?
    It would've been easily prevented.

  3. tuomas_wildspark

    Aug 23, 2023 17:48

    Happens on iOS as well.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.