Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by amokk_gw · Nov 20, 2015 at 06:49 PM · textuser interface

What's the best way to display large amount of UI text?

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.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image amokk_gw · Nov 21, 2015 at 12:33 AM 0
Share

I'm using a scroll rect as well, but after about 20 messages, I get "Canvas element contains more than 65535 vertices". The messages are not that long (About 30 characters each with an outline). And I don't need more than 50 messages, but 20 is just not enough.

I'll try to upgrade to the latest Unity version and see whether that fixes the issue. $$anonymous$$aybe they've reduced the amount of vertices for text.

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Dibbie · Nov 20, 2015 at 07:12 PM

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...

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image aosome23 · Mar 17, 2016 at 02:27 PM 0
Share

Did you use one text component or one text component for each line?

avatar image See_Sharp aosome23 · Mar 17, 2016 at 03:05 PM 0
Share

You could use one text component and enable rich text. That way you could flag each line with a tag, or anything else. $$anonymous$$ore info here

avatar image amokk_gw · Mar 17, 2016 at 03:11 PM 0
Share

I feel, that I'm doing something wrong. While Unity is not crashing anymore, if I add 5 messages with black outline to a scroll rect, it adds ~20k verts. 2k comes from the actual text and about 18k from the outline.

If I scroll with the rect it's actually lagging pretty hard.

avatar image See_Sharp amokk_gw · Mar 17, 2016 at 05:42 PM 0
Share

I know unity's latest UI is not that performance friendly, have you tried changing the font import settings from "Dynamic" to "Ascii .." ? Dynamic font's need to be recalculated everytime, which for example on iOS creates HUGE laggspikes

avatar image amokk_gw See_Sharp · Mar 21, 2016 at 03:40 PM 0
Share

I just tried that now, but it doesn't help. The result is the same. But if I disable the outline, everything seems to work fine.

avatar image
0

Answer by gresolio · Jul 27, 2016 at 08:32 PM

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: https://github.com/gresolio/Unity_UiTextLimit

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Finding all text labels in a scene 1 Answer

How do you create text that can be the child of a non-canvas object? 1 Answer

How do I get the Text Mesh Pro UGUI working in a prefab? 1 Answer

Scale UI Text 0 Answers

UI Text Small on screen device. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges