Hi,
I’m new to unity and this probably was asked multiple times, but I cannot seem to find the solution to my problem. I’m making a simple HiLow card game that use Score.txt file, which I placed in Assets folder, to store last score and high score. The problem occurs when I build the project. Bear in mind that everything works perfectly in unity editor. For some reason it doesn’t go after scoreSave() function is called and doesn’t load a new scene. So basiclly you never lose the game. I tried removing it and every thing worked perfectly. So I assume this is the problem.
This is the part of the code:
public void scoreSave()
{
StreamReader sr = new StreamReader(path);
string lastScore = sr.ReadLine();
string highScore = sr.ReadLine();
sr.Close();
int hScore = Convert.ToInt32(highScore);
if(hScore < score)
{
hScore = score;
}
StreamWriter sw = new StreamWriter(path);
sw.WriteLine(score);
sw.WriteLine(hScore);
sw.Close();
}
I tried to find a solution but no luck. I found some articles that says to check “output_log.txt”, but it doesn’t exist neither in C:\Users\username\AppData\Local\CompanyName\ProductName\output_log.txt neither in game directory. I did a scan on C: and D: discs but no luck.
Any suggestions?