- Home /
Reading text files on Andriod apk build
Hello guys, Basically I have my 3D GameObjects created from a text file which works fine on PC, but when I try building the game as .apk file to test it on an Android device the files were not loaded. The code to read the text file looks like this:
String Level = "Application.dataPath + "/StreamingAssets" + whatever the name of the text file im reading);
I've also tried doing this and build it which also doesnt work:
String Level = "jar:file://" + Application.dataPath + "!/assets" + whatever the name of the text file im reading);
Answer by sas_88 · May 12, 2015 at 10:50 AM
Application.dataPath works fine on PC but doesnot load assets or image in the path on mobile device.
Repalce Application.dataPath with Application.persistentDataPath it works fine.
String Level = "Application.persistentDataPath + "/StreamingAssets" + whatever the name of the text file im reading);
Your answer
Follow this Question
Related Questions
Get Contents of Folder Using UnityWebRequest 0 Answers
Deleting file on android 0 Answers
Can't build for either iOS or Android: Failed to copy/move file 0 Answers
Handheld.PlayFullScreenMovie not working on Android since unity upgrade? 1 Answer
StreamingAssets with platform specific files/folders 0 Answers