Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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
0
Question by samsap · Jul 13, 2015 at 08:37 PM · stringtextmeshmemory usageregex

"String too long for TextMeshGenerator. Cutting off characters." when doing Regex.Replace

Hi,

When executing

newstring = Regex.Replace(oldString, oldSubString, newSubString);

I get the following errors:

"String too long for TextMeshGenerator. Cutting off characters." "count <= std::numeric_limits::max()"

My string size is around 15000 characters and I am using Unity 5.1.1f1 (64-bit)

I have looked around for a solution but can´t find anything, any ideas or workarounds?

thanks!

Comment
Add comment · Show 3
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 zach-r-d · Jul 13, 2015 at 08:40 PM 1
Share

That error is most likely not co$$anonymous$$g from that line, but from passing that string to a TextArea. It's a limitation of TextArea where past a certain number of characters, it will simply refuse to render them, even though the text will still be there internally (scrolling to the end of the TextArea and deleting some characters shows this).

avatar image samsap · Jul 15, 2015 at 08:28 AM 0
Share

You are right, I don´t get the error from the Regex, I actually get it when I try to run GUILayout.Label (newString) after the replace. The Regex.Replace is causing the string to go from roughly 10k to 15k characters and I am guessing thats too much for GuiLayout.label, although the error messages don't point to any specific line in the code and they appear 3 times each...I will just split the text and render several labels, thanks

avatar image douglasg14b · Jul 16, 2015 at 12:40 AM 0
Share

I'm getting the same error, only after upgrading to 5.1.1f1. It's different each run, sometimes it throws at 700 characters, sometimes at 1300 characters, and other times at 2000+ characters. I have no clue whats causing it, but my chat areas are officially broken after the upgrade.

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by zzzzz · Jul 29, 2015 at 10:28 AM

The problem is you probably have it as a PUBLIC variable and therefore it shows in the INSPECTOR and the inspector is using GUI and GUI text fields are limited in size. I had the same problem but I do not know how to hide it from the INSPECTOR (I need it to be public)... Anyone?

Comment
Add comment · Show 2 · 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 douglasg14b · Jul 30, 2015 at 06:11 AM 1
Share

That is actually a different error that will throw on the inspector, this error has nothing to do with any inspector fields. This error is thrown within the Text class itself and originates from the TextGenerator on the object in your scene.

avatar image realworld666 · Feb 19, 2016 at 10:31 AM 1
Share

Add the attribute [HideInInspector] above your variable.

avatar image
0

Answer by bkachmar · Aug 18, 2015 at 02:19 PM

I had the same problem and restarting Unity solved it.

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
avatar image
0

Answer by sjpt · Dec 28, 2015 at 07:40 PM

Make it public in another class and the Inspector won't see it.

Comment
Add comment · Show 2 · 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 callen · Dec 28, 2015 at 07:45 PM 2
Share

Even simpler, if you're in C# you can convert the field to a property, as Unity won't serialize the property.

Before:

 public string $$anonymous$$yString;

After:

 public string $$anonymous$$yString { get; set; }

This is of course assu$$anonymous$$g that the issue was the text being too long for the editor GUI. If the issue exists outside the editor, this won't solve anything.

avatar image twinkle1087 callen · Jun 08, 2018 at 09:10 AM 0
Share

This $$anonymous$$ethod work,Thank you very much

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

Replace() with string and Regex not replacing numbers/integers 2 Answers

How to replace a word inside a string with different white space combos? 0 Answers

If Statements with PlayerPrefs 1 Answer

Regular Expressions in Unity 0 Answers

Get the upper Chars out of a string 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