Modifying a text file outside unity.

Hey, so I’ve got some code that creates a text file with some player data in it, but I can’t figure out how to either:

a)modify a value in the text file, or alternatively
b)delete the text file so I can rewrite it with new values.

Here’s the function I’m attempting to write:

function updatePlayerData()
{
	Delete(docPath); //this line throws an error.
	var sr = File.CreateText(docPath); 
    for(var i=0; i< playerInfoRealArray.length; i++)
	{
	     sr.WriteLine (playerInfoRealArray*);*
  • }*
    Debug.Log(“Updated the player’s data.”);
    sr.Close();
    }
    Any idea how to do it?
    Thanks!

Check that the file exists with File.Exists and delete with File.Delete.
To modify, you have to read the file (into strings if that’s what you’re doing), modify them, then write it out.