In the project to use the character text to do some information display, need to have color, font style, line wrapping and so on, Unity's Rich text can be used to do this kind of demand.
About the use of rich Text:
Http://docs.unity3d.com/Manual/StyledText.html
Although there is no mention of the "\ n" line break, it is actually supported.
Article transferred from Http://blog.csdn.net/huutu http://www.thisisgame.com.cn
There was a problem today when reading the contents of the CSV into Rich text.
is the content in the CSV, which is directly assigned to Text after reading. But there is no line break after running.
As it is, is Rich Text not supporting "\ n" for a newline?
Writes the contents of the CSV directly to the code, and assigns them to Text.
Found to be OK.
Article transferred from Http://blog.csdn.net/huutu http://www.thisisgame.com.cn
Suspicion is a problem with CSV. So the breakpoint to see what the code read out, sure enough to find the problem:
After reading the contents from the CSV, the original "\ n" became "\\n".
Personally think that in Excel, in order to "\ n" as the normal character processing and added "\" To mark the following is the normal character content.
Now that we know the reason, it is convenient to solve it. Just replace "\\n" with "\ n".
M_mainnoticetext.text = Noticeinfo. Title.replace ("\\n", "\ n");
article transferred from Http://blog.csdn.net/huutu http://www.thisisgame.com.cn
Unity3d read the text in CSV to Rich text line breaks do not recognize the problem