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?

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: VoltzerDev - YouTube