- Home /
How to adjust rect height according to amount of text in a TextMeshProUGUI?
I am trying to implement text reading using scroll view. Everything works, but depending of amount of words text is cut or there is too much space to scroll. I suppose there is very simple answer, but I can't figure it out. I don't know if I explained it correctly, I hope you understand my problem.
Answer by CPeniarth_HY · Aug 28, 2019 at 10:59 AM
I just ran into what I believe is a similar question to yours. I managed to get a TextMeshProUGUI gameobject working inside a scrollable container (using Unity's default UI scroll view) using a Vertical Layout Group and Content Size Fitter Component on the scroll view's Content game object ("instructions" is the name of my Content game object) with the following setup:

My Content game object includes a default TexMeshProUGUI element as its only child, but due to the Vertical Layout Group's addition I can add more should I need to.
Your answer
Follow this Question
Related Questions
Text disappearing whenever it feels like doing so. 1 Answer
URP Postprocessing & TextMesh Pro 1 Answer
How to update TMP Pro Sprite Shader using script/C#? 1 Answer
Text Mesh Pro : How to override standard text styling tags ? (bold, underline, etc ...) 0 Answers
how can i show number of lives as hearts (or other image) during gameplay 4 Answers