- Home /
How would you lower the amount of visible text lines in a TMP_Text Component?
I have this 1mb text file that is being loaded into a TMP_Text element. That text component is in a scroll view. Scrolling around is laggy, and im wondering if there is a way to only render the text that is in view of the camera? or change the amount of visible lines at a time. That way unity doesn't have to render all of the 1mb text at once. Is there anyway to maybe limit the meshes triangles? or having a render system or something?
Use the built-in "Paging" feature of Text$$anonymous$$eshPro?
@WinterboltGames Do you have an sources for documentation or anything of sorts?
I recommend you to check out the Rect$$anonymous$$ask2d component here is the link to the documentation https://docs.unity3d.com/2020.1/Documentation/$$anonymous$$anual/script-Rect$$anonymous$$ask2D.html
Hope it helps
I will give this a shot too! Thank you very much!
Answer by VoltzerDev · Jun 09, 2020 at 08:28 PM
Hey! It's quite hard to answear your question as it is not clear what kind of a setup you are using.
A first idea would be to use a "Mask" component on you scroll view if you haven't done so already.
1) If you have, I think that your best bet is making some sort of pagination. Split the text in code into smaller bits and have a next page button.
2) In my game, I have a list with 6 TMPro's each being a line in my text and when a new line appears I just take the top TMPro change its text to the new line and put it at the bottom of the list. I use a VerticalLayout component and change the ChildIndex to change the order of the children. By using this approach you can not use unity's scroll system, you can only make your own scrolling with the press of a button that shows the next line or the previous line.
Hope that helps!
If you wanna see how it looks like in my game check out my youtube channel: https://www.youtube.com/channel/UCq-S83BCJL3r9W9t3V9aYdA
I think the Page system is my best bet right now. Im just getting weird issued with my text mesh, it centres its self automatically for no reason and i can't change it in run time.
Your answer

Follow this Question
Related Questions
Importing Blender Object Splits Mesh Into 4 1 Answer
Text Highlight word by word when background voice is playing. 0 Answers
Adding vertices to TextMesh Pro 0 Answers
why does Mesh.SetColors take a list, but Mesh.colors is an array? 0 Answers
Procedurally generated mesh not Rendering all triangles 1 Answer