- Home /
File.Create not working
I used a Serializer script for a save system, but when I use a path that doesn't have the save file inside, it doesn't work. It says that it cannot find the file.
Stream stream = File.Open(Application.persistentDataPath + "/" + filePath, FileMode.Create);
FileMode.Create seems not to work, in creating a new file. I also used File.Exists to check if the file exists, and if not I used File.Create, but it did not work.
Update: It show me an error when I try to access an empty or missing file.
It says that it cannot find the file.
What exact error message are you seeing?
For that matter, which platform are you on?
when I use a path that doesn't have the save file inside, it doesn't work
Not sure what you mean by this. You're using a path that doesn't include the name of the file you're trying to open, and still expect it to open the file? Perhaps I'm missing something.
I was trying to Load the game data from the save file from the Start Function, so when the file was missing or empty, i got an error :X
So I used to check if the file exists (in javascript), and if it does then load the data. I don't know how to check if the file is empty.
localData = SaveAndLoad.Load(); }''if (System.IO.File.Exists(SaveAndLoad.currentFilePath)){
Your answer
Follow this Question
Related Questions
How do you create a folder in c#? 3 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Simple Questionnaire Game Logic? 2 Answers
Open default file with monodevelop 0 Answers