Is it possible to access non-text files in the Resources folder in an iPad app?
I can read and write to binary data files in the Resources folder in Unity, but can’t read from them in the app on iPad (haven’t tried writing). I used FileStream and BinaryWriter to create the files, a one-time thing I won’t need to do in the finished app. But I need to read those files at runtime. I used BinaryReader to do that, and it works in Unity. But after installing on the iPad, it cannot find the files. The path I used to write/read the files is:
I think the files are there, as I’ve used text files in the Resources folder in another app and had no problem reading those. But I used Resource.Load and didn’t have to specify a path name in that app. Can’t do that now because these are not text files (or any standard asset format).
Do I need to use a different path in the built app than in Unity? How can I even tell if the files are there, since I can’t find them in the app bundle?
The Resources folder doesn’t actually exist in a build, except as an abstract concept. The assets get merged into a sharedassets file; you won’t find an actual folder called “Resources” with separate assets in it anywhere.
So, you’re saying I can’t save data files in the Resources folder and access them in an app on iPad?
If so, is my only option is to save them as text assets? But converting the data to strings makes the files much larger, which is why I tried binary files to begin with.
Sounds like a solution. I’ll give it a try tomorrow morning when I’m a bit fresher. Any idea what path I would use to get to that folder once it’s inside the app bundle?
I don’t see that folder in the app bundle, and I can’t get it to work in Unity either. I placed the iPhoneStreamingAssets folder at the same level as the Assets folder, just like it says in the script reference. So shouldn’t the path be:
That looks like it’s for loading bytes from a PNG file into textures. My data would not work as a texture. Even so, I’m not sure how I would parse the bytes out of the texture.