Select a random line of a text file and send it into a Text field
Hey everyone.
So... how can I made that code bellow to be able to random select a line from a text file and send it to appears at a Text Field into the game world? That code is already running perfectly, it takes a line from the text file, and send it to the Text Field, but I want to be able to make it random though all the lines I have int the file which isn't that, I think must be something around ten lines.
Here the code:
public class randomControl : MonoBehaviour {
public Text randomAirlines;
public void randomFlightLoad (string doc)
{
using (StreamReader reader = new StreamReader (@"Assets\Lists\airlines.lis"))
{
randomAirlines.GetComponent<Text>().text = reader.ReadLine();
reader.Close();
}
}
}
That's all, thanks.
Comment
Your answer
Follow this Question
Related Questions
Text File Show Problem In Android Apk 0 Answers