Search Unity

Bug Input TextField text selection (TextMeshPro 3.0.6, Unity 2021.3.21f1)

Discussion in 'UGUI & TextMesh Pro' started by koZis, Apr 27, 2023.

  1. koZis

    koZis

    Joined:
    Jun 1, 2017
    Posts:
    8
    When I try to select text via mouse cursor in input textfield, application crashes with error:

    UnassignedReferenceException: The variable m_TextViewport of TMP_InputField has not been assigned.
    You probably need to assign the m_TextViewport variable of the TMP_InputField script in the inspector.
    UnityEngine.Transform.get_rotation () (at <ba783288ca164d3099898a8819fcec1c>:0)
    UnityEngine.RectTransformUtility.ScreenPointToWorldPointInRectangle (UnityEngine.RectTransform rect, UnityEngine.Vector2 screenPoint, UnityEngine.Camera cam, UnityEngine.Vector3& worldPoint) (at <d81e1bf4263c45bfaefffe2fa3fa3ddc>:0)
    UnityEngine.RectTransformUtility.ScreenPointToLocalPointInRectangle (UnityEngine.RectTransform rect, UnityEngine.Vector2 screenPoint, UnityEngine.Camera cam, UnityEngine.Vector2& localPoint) (at <d81e1bf4263c45bfaefffe2fa3fa3ddc>:0)
    TMPro.TMP_InputField+<MouseDragOutsideRect>d__295.MoveNext () (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_InputField.cs:1719)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <ba783288ca164d3099898a8819fcec1c>:0)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    TMPro.TMP_InputField:OnDrag(PointerEventData) (at Library/PackageCache/com.unity.textmeshpro@3.0.6/Scripts/Runtime/TMP_InputField.cs:1704)
    UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:514)
     
  2. jlfreund

    jlfreund

    Joined:
    May 5, 2017
    Posts:
    5
    +1 got the same error when clicking in a TMP edit view, and pressing backspace, the app froze with this stack trace. Under inspector, I see my TMP_InputField "Text Viewport" property is unset ("None (Rect Transform)", but that evidently works fine most of the time. Not sure what I should do there.