• 9
• 11
• 9
• 20
• 12
• ### Similar Content

•    Hello , i would like to showcase my first game project, a simple endless casual arcade game called Apples Mania : Apple Catcher. The game has simple goal , scoring as high as possible by collecting falling apples while the difficulty gradually increases. Different apples are worth different amount of points and there are also 2 superpower to help you in your challenge.
The game took me about 2 months to complete and polish and i made everything except for the music tracks and some of the sound files. Made in unity and blender3d.
Would appreciate any kind of feedback.

A trailer showing basic game-play:

• By Paszq
Troglodytes are a playable races in Arpago - they usually don't talk much and most of them lives near water sources.
• By Paszq
a Fox in a dungeon :)
• By Paszq
Fox Folk is one of 3 playable races in Arpago.
• By Paszq
An overview of an area south of the city. You can see a graveyard in the back, surrounded by mountains.

# Unity Isolatedstorageexception : Could Not Find File

This topic is 633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm trying to save/load player data from a file using the persistenceDataPath using the following code:

private void Save()
{
if (File.Exists (Application.persistentDataPath + "/playerInfo.dat"))
{
FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
data.userExperience = userExperience;
bf.Serialize (file, data);
file.Close ();
}
}

{
if (File.Exists (Application.persistentDataPath + "/playerInfo.dat"))
{
FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat ", FileMode.Open);
PlayerData data = (PlayerData)bf.Deserialize (file);
userExperience = data.userExperience;
file.Close ();
}
}

[Serializable]
class PlayerData
{
public int userExperience;
}


It works fine if I play the game with Unity Editor. However, on Android, when I try to execute this line of code in Load():

FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat ", FileMode.Open);

I get this error:

The file does exist since the code pass through the if(File.Exist...) and it works when I try to access the file from the Save() method.

I really don't know what it could be since the code that open the file in Save() and Load() is the same.

Edited by RationeUtor

##### Share on other sites

I don't know if this is relevant but

if (File.Exists (Application.persistentDataPath + "/playerInfo.dat"))
{
FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat ", FileMode.Open);

On the second line you have a space after .dat. Again I don't know if that is something but delete it and see if ti helps particularly as it thinks the file exists from the first line.

##### Share on other sites

I don't know if this is relevant but

if (File.Exists (Application.persistentDataPath + "/playerInfo.dat"))
{
FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat ", FileMode.Open);

On the second line you have a space after .dat. Again I don't know if that is something but delete it and see if ti helps particularly as it thinks the file exists from the first line.

Yes it was that! LOL. Lost one entire day for a type error

Apparently when playing from the Unity editor it was still able to access the path even with the space at the end.

Thank you!

Edited by RationeUtor