- Home /
StreamingAssets and reading a binary file (Android)
I am trying to bring in a binary file that I have saved in StreamingAssets folder but can't work out how to get it to be read on Android.
Here is the original resources code that works on computer but not Android.
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Open(Application.dataPath+"/Resources/Demos/" + scene.name + "Demo", FileMode.Open); // Change to demo file
demoReplayList = (List<GhostShot>)bf.Deserialize(file);
file.Close();
I don't want to use the Resources folder (unless it is the correct way of doing it) cause I feel StreamingAssets is the correct location for this file. Anyway, here is where i'm at...
string filePath = Application.streamingAssetsPath + "Demos/" + scene.name + "Demo";
if (Application.platform == RuntimePlatform.Android)
{
WWW reader = new WWW(filePath);
while (!reader.isDone) { }
//Now what?
}
Can I just add my original code and use "reader" as the file now? or do I assign reader to another variable type?
Thanks
Your answer
Follow this Question
Related Questions
StreamingAssets - reading from file on android 0 Answers
Get Contents of Folder Using UnityWebRequest 0 Answers
Android - Use SQLite database in other folder than StreamingAssets folder 0 Answers
StreamingAssets Folder Max Size 2 Answers
I can't figure out how to use www to copy a file / very confused about porting to android... 0 Answers