unity處理配置文件中的換行符

asklist[i].answer 是從配置文件中解析得到的字符串
處理後賦值給Text
根據字符串的行數,改變Text的高度

					 answertxt.Show();                   
                    string ans = System.Text.RegularExpressions.Regex.Unescape(asklist[i].answer);
                    string[] split = ans.Split(new char[2] { '\r', '\n' });                 
                    top -= (48+ (30 * split.Length));
                    answertxt.SetWidthHeight(contentWidth - 56, 30 * split.Length);
                    answertxt.SetText(ans);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章