I’ve put this off for a little while and having come back to it, it still seems impossible for me to figure out.
I have my file structure set up such that the StreamingAssets folder contains a few folders, and then inside those each contain a number of text files to be read.
On iOS, its no problem to use
var info = new DirectoryInfo(Application.streamingAssetsPath + "/Text/" + subFolder);
FileInfo[] fileInfo = info.GetFiles ();
foreach (FileInfo file in fileInfo) {
// Handle each file
}
but I can’t for the life of me figure out how to get even the first sign of a result on Android.
I’ve come to the understanding that the files are held inside the apk, so they can’t be accessed by these simple means. I’ve seen people suggest using WWW but I can’t seem to understand how that works either.
Using either
WWW data = new WWW("Application.streamingAssetsPath + "/Text/"");
or
WWW data = new WWW("jar:file://" + Application.dataPath + "!/assets/Text/");
to take a look at the folder contents doesn’t work, but it doesn’t surprise me that much since I don’t imagine WWW could hold something like files in a directory. But not only that, I get an error of
java.io.FileNotFoundException: assets/Text/
When looking at the apk itself, the files and folders are definitely in there which follow the same structure as
"jar:file://" + Application.dataPath + "!/assets/Text/"
I can’t remember what else I’ve tried over the past while. This seemed the most hopeful, but I’m still just as confused as when I started. Theres gotta be an easy way, isnt there?