- Home /
Solved
Unity-Android read file from device storage
I'm working on a VR android app and it needs to read a file from phone storage - the path looks like this on windows browser - phone/foldername/file.cfg and on the device, the path looks like this- /storage/emulated/0/foldername/file.cfg I have been using Application.persistentDataPath which points to the project data folder on device's external storage. Is there anyway I can read files from the path mentioned above on the android device from Unity? Or does Unity not allow this?
Answer by molul · Dec 10, 2017 at 11:10 PM
Did you find out the answer yourself? I'm having the same problem and can't find a word about it :(
Yes, I used the IndexOf function on Application.persistentDataPath so that will take you back to internal storage.
Application.persistentDataPath.Substring (0, Application.persistentDataPath.IndexOf ("/Android")) + "/YourFolderName";
https://msdn.microsoft.com/en-us/library/k8b1470s(v=vs.110).aspx