make list of questions from txt file and make it work in android. c#
Hello, I'm making a quiz game more or less. I'm stuck in a problem with the paths because I'm triying to make a dev build for android but when it's complete and I install it the game load a empty screen and nothing shows up.
In the computer all works fine and I can also get the question using something like this
//this for download the questions:
WebClient client = new WebClient();
client.DownloadFile("http://keruanima.com/grownups.txt",Application.dataPath + "/Resources/TextFile/grownups.txt");
//this to make the list of questions:
string curline; //current line
StreamReader fileAdults = new System.IO.StreamReader(Application.dataPath + "/Resources/TextFile/grownups.txt");
while ((curline = fileAdults.ReadLine()) != null)
{
adultQuestions.Add(curline);
}
And now I'm a bit lost trying to change the way I write the paths to make it work because I know it's because the game in android doesn't find this paths but I can't solve it.
Answer by Landern · Nov 29, 2016 at 03:59 PM
use Application.persistentDataPath instead for ios and android
Application.dataPath is noted in the documention for ios as readonly and android as pointing to the apk or obb depending on how the application is deployed.
If you want to use both use compiler directives to set the code differently depending on the targeted platform
Your answer
![](https://koobas.hobune.stream/wayback/20220612101640im_/https://answers.unity.com/themes/thub/images/avi.jpg)