NullRefException @ InputField.UpdateLabel()

NullReferenceException: Object reference not set to an instance of an object
TMPro.TMP_InputField.UpdateLabel () (at Library/PackageCache/com.unity.textmeshpro@3.0.0-preview.13/Scripts/Runtime/TMP_InputField.cs:3181)
TMPro.TMP_InputField.SetText (System.String value, System.Boolean sendCallback) (at Library/PackageCache/com.unity.textmeshpro@3.0.0-preview.13/Scripts/Runtime/TMP_InputField.cs:575)
TMPro.TMP_InputField.SetTextWithoutNotify (System.String input) (at Library/PackageCache/com.unity.textmeshpro@3.0.0-preview.13/Scripts/Runtime/TMP_InputField.cs:514)
ToLSettings.InitLogsPreset () (at Assets/_Imperium42/_Scripts/UI/Settings/ToLSettings.cs:625)
UnityEngine.Events.InvokableCall.Invoke () (at <fe83287b9d2c49cba7f18dc22475c71f>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <fe83287b9d2c49cba7f18dc22475c71f>:0)
UnityEngine.UI.Button.Press () (at C:/Program Files/Unity/Hub/Editor/2020.1.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:68)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2020.1.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:110)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2020.1.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2020.1.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2020.1.0b2/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:374)

I’m not quite sure what’s going on here, but I’m spawning a prefab containing some input fields like a journal:

If I spam click to set active it a few times, it’ll finally show but not let users edit (users could previously edit). Which is a bit strange. Error indicates it’s some TMPro error involving InputField when it sets active.

Oops, forgot to prefix title with TMPro. Ping @Stephan_B

Be sure to test with version 3.0.0 to see if the behavior is the same.

If the issue persists, can you provide me with some repro project or access to whatever you are using via private PM or something. Whatever is simplest for you that will allow me to reproduce the issue to resolve it.

1 Like

3.0.0 still has it: Make Mockups, Logos, Videos and Designs in Seconds

Fixed with null check editing TMP src: Not sure if there are any side effects, though.

EDIT: Ah, I need to embed the pkg or it resets.

@Stephan_B No rush, but just wanted to make sure you saw the workaround that may be a fix ^ Pls @anon_79495420 me if you remember when it gets patched (I’m currently embedding the package with this fix, but last time I forgot I did this after a period of time went by :stuck_out_tongue: would love to patch up for my future memory)

Same issue here, just trying to set inputfield text from the Awake

Just a reminder bump @Stephan_B

When you reference “spam click set active”, you mean enabling and disabling the input field or its parent. Correct?

I am trying to understand what leads the the textInfo of the object being null.

1 Like

Correct. All the button does is set the input active.

I have addressed the above issue.

The fix will be included in the next release of the TMP package.

6258287--691890--upload_2020-9-1_12-5-49.png

Fix is essentially just a null check, but I also did some minor clean up while at it.

1 Like

This validation fixed this problem, PLEASE, update the TMPro.

NullReferenceException: Object reference not set to an instance of an object.

TMPro.TMP_InputField.OnSubmit (UnityEngine.EventSystems.BaseEventData eventData) (at <00000000000000000000000000000000>:0)