Hello,
I have recently decided to implement a save function to my game, I am new to this whole area so bare with me.
I have adopted some code I found online for loading, it looks like this:
function fileLoad ()
{
try
{
// Create an instance of StreamReader to read from a file.
sr = new StreamReader("TestFile.txt");
// Read and display lines from the file until the end of the file is reached.
line = sr.ReadLine();
while (line != null)
{
print(line);
line = sr.ReadLine();
}
sr.Close();
}
catch (e)
{
// Let the user know what went wrong.
print("The file could not be read:");
print(e.Message);
}
}
My question is, how can I get the line number of the file that is being read (ex. line 146 = playerDamage).
Any help is appreciated!