- Home /
Try Catch Error Unity 5 EditorWindow
I have a editor window script which will make a error in the Console when displaying a long string in a label. I am trying to just catch this error and don't display it in the console. The string will be around 73K characters and is stored inside a variable in the script.
I just display that in the GUI to allow the user to copy it. What are the ways I could catch and just ignore the error. I don't want the error to be seen.
String too long for TextMeshGenerator. Cutting off characters. UnityEditor.EditorGUILayout:LabelField(String, String, GUILayoutOption[])
using c#
I tried the normal try{}catch(exception ex){} like I would in a WinForm App but it doesn't works.
I trimmed the string using substring, but what are the other ways of catching the error ? I have several other places where error might occur, but I don't want to display it in the Console.
I am having same Issue. did you find the solution already?
Hey, no never did. I just had to work around the problem. $$anonymous$$ake a function to trim the number of characters to 100 if they are more than 100 and return it. (function should be a string). When outputting in in GUI, just pass the value through the function and it should be good. For other kind of errors, you can work through it in the same way (if object exists then proceed with function and etc)
umm I am not able to figure out that which game object is causing this error. But I have been told that its a Bug in Unity version 5.0.2f. which is fixed in later version. Reference Link
Your answer
![](https://koobas.hobune.stream/wayback/20220613200440im_/https://answers.unity.com/themes/thub/images/avi.jpg)