Hello, I need help saving a text file to my android game
I’m using Application.persistentDataPath + “save.txt”
but when I save it on my android phone I don’t see the text file. It does have a folder on the phone for the game though. What am I doing wrong? Here is my function
var directory = Application.persistentDataPath + "/save";
function Start () {
if (!System.IO.Directory.Exists(directory)){
System.IO.Directory.CreateDirectory(directory);
save2();
}
}
var saved2 = Application.persistentDataPath + "/save/astroids.txt";
function save2(){
pla2 = GameObject.FindGameObjectsWithTag("planet");
var sw1 = new StreamWriter(saved2);
for( var pln1 : GameObject in pla2){
var pls1 : planetbehave = pln1.GetComponent(planetbehave);
sw1.WriteLine("---");
sw1.WriteLine("" + pln1.transform.position.x + "
“);
sw1.WriteLine(”" + pln1.transform.position.z + "
“);
sw1.WriteLine(”" + pls1.health + "
“);
sw1.WriteLine(”" + pls1.sizes + "
");
}
sw1.Flush();
sw1.Close();
}