"String too long for TextMeshGenerator. Cutting off characters."

I keep getting the above mentioned error; “String too long for TextMeshGenerator. Cutting off characters.”

I’m sure it’s because I’m hitting the vertex limit or something similar, but my game relies on the player entering a lot of text (for the purpose of writing) and the testers apparently keep getting this error when the text gets too long.

Is there any way around it?

Can you break it up by paragraph into different mesh objects? Can you cull non-visible paragraphs?

I’m not sure how to do that functionally while letting the player go back and edit something if they want.

I’m running into this today… and so far, my googling only turns up a lot of other people with the same question, and no real solutions. :frowning:

I wonder if the new TMPro integration will fix it? Possibly. Or else, somebody really needs to make some new Text (and InputField) components that don’t suck.

I noticed I’ll get this error with TMPro as well. It’s a limitation of Unity and I guess how it handles text. TMPro does have an option to auto split text beyond one box so if the text gets to large, it will spill over to another box, but I don’t think this works with inputfields.

If all you’re doing is pure text without anything else, I don’t think TMPro will help any. I don’t think I ever found a good solution to this yet, but I’m interested if anybody finds something as we’re doing a book app right now and we may run into a page that with the formatting tags may end up to large.

Anybody knows what this limit is precisely? Knowing this number will let us cap/split strings accordingly

16382*

one char more and error
*according to GUILayout.Label (2017.3.0p3)

1 Like

@andrew-lukasik 65535/4 = 16383.75
It seems that Label uses 4 vertex per character to construct mesh.
16382 is just below 16383.75

1 Like

Agreed, my Text in UGUI triggers this error when I had around 16482 characters