- Home /
Change location of binary file created when saving
Hey, I'm making a game that saves high scores, I want said high scores to go alongside the game wherever, so I want them in the same foldier as the .exe files is.
I saw the tutorial on Unity about saving, it all works fine, issue is this line of code
FileStream file = File.Create(Application.persistentDataPath + "/rankings.pac");
Where is the rankings.pac file being saved? And how do I change it so its in the same path as the .exe file.
Answer by eses · Aug 12, 2018 at 07:37 AM
If you google for "unity persistent datapath", it leads to official documentation: https://docs.unity3d.com/ScriptReference/Application-persistentDataPath.html. Basically it is different location depending on the selected target platform.
There are threads about this issue, like this one: https://answers.unity.com/questions/1144351/cant-find-applicationpersistentdatapath-location.html
Edit: however, I'm not sure if you will be able to save to any directory you want.
Your answer
Follow this Question
Related Questions
from bool array to binary file? 1 Answer
Writing binary files on Android 1 Answer
Sharing Violation On Path 1 Answer
Saving script variations 1 Answer
Best method to save a multi-dimensional array as a file? 1 Answer