- Home /
Question by
Toonbull · Oct 08, 2021 at 06:57 PM ·
textlocalization
Read text file with non-english characters?
Hello everyone. This is the first time I'm posting a question here so I hope I'm doing everything right. My game is supposed to read a referenced text file, pick lines and show them on a textmeshpro. My code is too long so I'm only showing you the relevant parts:
public List<TextAsset> event_text_files = new List<TextAsset>();//a list of text files in different languages
public TextAsset event_text_file;
string new_events;
void Start()
{
event_text_file = event_text_files[PlayerPrefs.GetInt("lang")];//selects one of the files
}
void Update
{
.
.
.
new_events += event_text_file.ToString().Split('\r')[i] + '\n';//picks the ith line from the text and adds it to the string object to be used later
.
.
.
}
This works perfectly fine with the english text file but it cannot pick lines when when the text file contains non-english characters and gives IndexOutOfRange error mesage. What am I supposed to do at this point?
Comment