I’m looking for a way to expand the InputField height by the amount of text contained, preferably for TextMeshPro InputField.
The examples I have found don’t work happily within Vertical Layout Groups, the first line disappears when starting a new line.
I did exactly that but I used custom components I made from Better UI 2.0 (beta).
If you are deciding to try Better UI 2.0 Beta out (write me a PM) I can tell you how to achieve this:
- Add a
Better Content Size Fitter
Component next to the (Better) Text Mesh Pro Input Field
Component.
- Set the
Source
object of the Better Content Size Fitter
to the Text
lower in the hierarchy (This will tell the content size fitter that it should fit to the size of the Text, not itself).
- Set the
Vertical Fit
to Preferred Size
.
- Select the
Text
object and add a Size Change Tracker
component there. Add the parent object which has the (Better) Text Mesh Pro Input Field
to the Affected Objects
List (this will tell the parent all the time when the size changes)
2 Likes
I’ll be sure to check this out!