diff --git a/Assets/TextMesh Pro/Scripts/Runtime/TMP_InputField.cs b/Assets/TextMesh Pro/Scripts/Runtime/TMP_InputField.cs index 2144343..302ab2d 100644 --- a/Assets/TextMesh Pro/Scripts/Runtime/TMP_InputField.cs +++ b/Assets/TextMesh Pro/Scripts/Runtime/TMP_InputField.cs @@ -4524,7 +4524,12 @@ namespace TMPro if (m_TextViewport != null) horizontalPadding += m_TextViewport.offsetMin.x - m_TextViewport.offsetMax.x; - return m_TextComponent.preferredWidth + horizontalPadding; // Should add some extra padding for caret + var preferredWidth = m_TextComponent.preferredWidth; + + if (m_Placeholder != null && m_Placeholder.TryGetComponent(out var e) && e.preferredWidth > preferredWidth) + preferredWidth = e.preferredWidth; + + return preferredWidth + horizontalPadding; // Should add some extra padding for caret } } @@ -4556,7 +4561,12 @@ namespace TMPro if (m_TextViewport != null) verticalPadding += m_TextViewport.offsetMin.y - m_TextViewport.offsetMax.y; - return m_TextComponent.preferredHeight + verticalPadding; + var preferredHeight = m_TextComponent.preferredHeight; + + if (m_Placeholder != null && m_Placeholder.TryGetComponent(out var e) && e.preferredHeight > preferredHeight) + preferredHeight = e.preferredHeight; + + return preferredHeight + verticalPadding; } }