Z
Z
Zefirot2021-10-31 10:54:08
Unity
Zefirot, 2021-10-31 10:54:08

Is it possible to store files inside the game folder?

I have files with data about rooms, studies, statistics, etc. stored as follows

string Path= Application.persistentDataPath + "/Data/Game/Info.txt";
string w = "какая-то информация";
StreamWriter sw;
sw = new StreamWriter(Path);
sw.WriteLine(w);
sw.Close();

On a PC it will be stored somewhere in user/AppData/LocalLow/MyProject/MyGame/Data/Game/Info.txt
On a smartphone somewhere Android/data/MyProject/ etc.
The problem is that if the system is reinstalled on the PC or this folder is “accidentally” deleted, or the phone is pressed to delete data, then all achievements (data about rooms, research, statistics, etc.) will be erased, well, and the user will have to start over from scratch...

Is it possible to somehow store the files inside the game itself so that they cannot be erased? (well, unless you delete the game itself)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-10-31
@Zefirot

The whole problem is in the rights in the file system.
Not even a computer, storing data next to the .exe is not particularly difficult. But if the game is installed in ProgramFiles, then admin rights will be required for recording. And such a game will most likely go to the forest.
On mobile, this is not possible at all.
But in general, the problem itself is not worth a damn, if the user himself deleted the saves, why ask questions about where they are?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question