Hi everyone,
I just noticed that whenever i compiled and re-deploy my game on test device, my saved file has been replaced with newly created file, that’s mean if i update my game to newer version, all users record will be lost. Right now, my method look like this:
std::string path = FileUtils::getInstance()->getWritablePath() + “\Player_Data.dat”;
std::ifstream readData(path, std::ios::binary);
if (readData.is_open()) {
//if file existed, read data from file
readData.read((char*)&_playerData, sizeof(PlayerData)); } else {
//if not, create new file with default value
_playerData.bestScore = 0; saveToFile(); } readData.close();
Do anybody have a suggestion?