I get this error on Android 6.0 Meizu M5s, when I recieve “inputField.onSubmit” and hide “inputField.gameObject.SetActive(false)” in it.
I attach Unity project and apk, which represent this bug.
I think bug here:
I know that a similar bug was reported a few months back. Please be sure to test with the latest release of whatever version of Unity you are using as well as the latest for TMP.
By latest, I mean if you are on Unity 2019.4, the latest is 2019.4.26f1 and the latest TMP package for 2019.4 is 2.1.6.
I tried to make the example simple. Enter any text in the first field on your mobile device and click done/ok. The mobile keyboard should disappear, the input field should disappear and what gets into the log is displayed on the right. To return the input field, there is a “Restore” button. All the code is in sample.cs
I was able to reproduce the issue which is simply related to the fact that OnSubmit() is called before
SendTouchScreenKeyboardStatusChanged() which in theory is fine. However, since you are disabling the input field in OnSubmit() this results in OnDisable() getting called which in turn calls DeactivateInputField() which then sets the soft keyboard to null.
It would seem that calling SendTouchScreenKeyboardStatusChanged() first and then OnSubmit() might be the appropriate change here but I am not entirely sure yet.
In my project, I try to work around this problem. Therefore, I tried to send data and hide inputField not to onSubmit, but to onTouchScreenKeyboardStatusChanged. Unfortunately, if you hide the input field in it, the Exception appears further in LateUpdate. In the picture, I showed the possible location of the error. I think “else if” is appropriate here.
I just got this issue as well from user reports (not myself, not sure if it’s the exact same repro case, but same null error). Using TMPro 3.0.6. Is there coming a major version change soon or what’s causing the delay? @Stephan_B