sometimes I need to generate large strings, sometimes thousands of lines long… and update them very frequently, every frame or more.
I’m looking for a way to update a text component, but have unity only render what is visible, will a mask / scrollview accomplish this? Or is everything rendered first anyway before being clipped?
Would using an input panel be an acceptable solution?
The answer at present is yes and no.
Yes the Mask will limit what is drawn to the screen and save you rendering, however this just descopes the size of the quad it draws.
No it will likely not same you processing time as the Text component still does it’s draw calculation prior to the mask, it works as if the mask isn’t there.
However, there should be no big performance hit working with a lot of text, it still is only a single quad.
If you are concerned about performance, then consider using a separate text component for each paragraph or line, manage and the updates at that level, then only update the text components you need to change.
Just to clarify - The text is 4 vertices / 2 triangles per character. The more characters your text object contains, the more triangles will need to be rendered. This can be verified by creating a text object and looking at the Stats - Tris.
There is also a limit of 65535 vertices per text object which would limit how many characters / lines of text are possible per object.
[quote=“holyjewsus, post:1, topic: 577899, username:holyjewsus”]
sometimes I need to generate large strings, sometimes thousands of lines long… and update them very frequently, every frame or more.
[/quote] See my comment in previous post about limitation on how many characters each text object can contain.
The whole text has to be parsed and geometry created and then the masking takes place in the shader to determine which part of the geometry will be visible.
Can you provide more insight / details on your needs? For instance, are you trying to limit what is visible like displaying only a page of text or just a certain range of lines or characters?
I am implementing a visual programming language, when I update the node’s output values I print them to text label, I’m currently dumping the text into an input view instead of what you see in the picture, as it seems to me that unity’s input field handles rendering/generating only the visible text based of the rect of the input field… What I would like is a very fast scroll window that only generates text as it comes into view.