- Home /
Scrollable Text of Arbitrary Length
The new Text component seems to have a limit of 16,384 characters. I'm building a scrollable log window that needs to be able to store an arbitrary amount of text. It's nice that Unity supports attaching a scrollbar to a scroll rect, but this won't work for large amounts of text.
I could write a script that links a scrollbar to a potentially large amount of text, and populates a text component with just the visible text of a much larger document. But that's a pain in the ass. It also seems like pretty basic functionality. Does something like this already exist, that I haven't been able to find?
$$anonymous$$y experience is with NGUI, so fogive me if this is not an appropriate workaround:
Perhaps you could split your text into "page" GameObjects, and have your scrolling window populated with those pages.
I could do something like that. Break the text into pages. Have at most two pages visible at a time. But that would be work to implement. I'm hoping somebody has already written something like this, or there's an obvious solution that I am missing.
I can't be the only person to ever want this type of thing.
I've created a scroll panel that expand to fit its contents then add each new piece of text as a different Text component.
Not got access to Unity at the moment but look on Youtube for Richard Gubb as he does a tutorial with buttons filling a panel that its based on.
Ill post the code when I get back to my Unity PC if you still dont have an answer by then.
EDIT:
That's a fair point, hadn't realized just how much info you had, that's pretty much a bookcase worth! Not sure I can help but if it gives anyone else any ideas how are you storing the text? In a database, just a text file or some other method?
For a massive amount of text, the scroll panel would have to be massive as well. That might work fine for a page or two, but with 100 mb of data I can't imagine that working.
It would just need to display a small part of a larger amount of data. $$anonymous$$aybe it calculates what to put into a pre sized Text object? $$anonymous$$aybe, as VesuvianPrime suggested, it could break the data into pages and only display one or two at a time?
I just can't imagine something like this hasn't already been written.
I had the same problem with a console log of a communication server, finally I decided to show the last ~150 entry lines and save every older entry to a log file. I'm still looking for a better solution too.