Game Development Reference
In-Depth Information
using(StreamWriter sw = new
StreamWriter(sDirectory + sFileName))
{
sw.WriteLine(PlayerPrefs.GetInt("PlayerKills").ToString());
sw.WriteLine(PlayerPrefs.GetInt("PlayerDeaths").ToString());
sw.WriteLine(PlayerPrefs.GetInt("PlayerTotalGold").ToString());
sw.WriteLine(PlayerPrefs.GetInt("PlayerCurrentGold").ToString());
sw.WriteLine(PlayerPrefs.GetInt("PlayerGoldSpent").ToString());
sw.WriteLine(PlayerPrefs.GetInt("PlayerLevel").ToString());
sw.WriteLine(PlayerPrefs.GetInt("PlayerRoundsWon").ToString());
sw.WriteLine(PlayerPrefs.GetInt("PlayerRoundsLost").ToString());
sw.WriteLine(PlayerPrefs.GetFloat("PlayerKDR").ToString());
sw.WriteLine(PlayerPrefs.GetFloat("PlayerWLR").ToString());
sw.WriteLine(PlayerPrefs.GetFloat("PlayerTimePlayed").ToString());
sw.WriteLine(Player.transform.position.x.ToString());
sw.WriteLine(Player.transform.position.y.ToString());
sw.WriteLine(Player.transform.position.z.ToString());
}
}
This function takes in a string. We have set the string to a blank value; this will allow
us to call the function with or without sending the value. To start off the function, we
check whether the file has a value; if it does, then we will use it as our new filename.
Search WWH ::




Custom Search