I have some issues with the Unity UI Vertex cap of 65535 per canvas. First of all, I’m still on Unity 4.6. In case anything changed to the vertex cap limit since then, please let me know.
Otherwise, what’s the best practices to show a combat log, which can have quite some text? I already run into the vertex cap after ~20 lines of text, which is not a whole lot. It seems like it’s very unnecessary that UI text needs that many vertices to be displayed.
I would then say it has changed a lot? Cause one of my game projects has a combat log embedded into the chat log too (I know, bad combo…), and it reports EVERYTHING, from server announcements, new matches, players talking, AI talking, location, and general combat, the first 30 seconds, is somewhere like 300 and something lines, and they are detailed… (and color coded)
But I simulate a “scroll rect” as well. So my text is displayed inside a panel, which is inside a “container” (which is actually a panel), with a mask, and scroll bar.
But I also have a “threshold”, after 2000 messages, the first message gets deleted, so my “log” only ever shows the most recent 2000 messages, after that, its gone. So it depends on how far you want to keep messages too, if your okay with having it eventually cleared, you can add code to start clearing the first line of this log, after you reach a certain line count, by just putting every single message into 1 large array, and adding every new line, as the next free element in the array, then after the array is full, clear the first element, move everything up by 1, add the new text in.
Probably a pretty “bad” way to do it, but I never experienced any problems with it before, and I was using Windows 7 on a crappy like 2 GB RAM PC, full of viruses and just slow as crap… And it was fine with no lag due to my code…
A simple but quite effective solution: http://forum.unity3d.com/threads/dynamic-scrolling-text-support.360026/
In short: use one “Text” component per line (or more, up to limit), and use new “RectMask2D” instead of “Mask”. “Vertical Layout Group” and “Content Size Fitter” will help you to place the items correctly. “Layout Element” would be useful to set the minimum height of the item. That’s all. Good enough for large amount of text with scroll support
My small project to test the idea: GitHub - gresolio/Unity_UiTextLimit: Unity UI.Text component vertex limit