通过代码中的\n可以直接执行换行效果,但是我们在平常的工作中一般都是读表,既在Inspector面板中的Text组件中输入同样的内容就达不到换行效果;
其实unity把\n转变成了\\n,我们只需要变回来就可以了,代码如下
string GetLanguage(string text){
string text1 = text.Replace("\\n","\n");
return text1;
}
通过代码中的\n可以直接执行换行效果,但是我们在平常的工作中一般都是读表,既在Inspector面板中的Text组件中输入同样的内容就达不到换行效果;
其实unity把\n转变成了\\n,我们只需要变回来就可以了,代码如下
string GetLanguage(string text){
string text1 = text.Replace("\\n","\n");
return text1;
}