So forgive me for being new to android development but, when I build my apk for my android app it keeps not being able to find a file at /Storage/emulated/0/Android/data/myAPP/files/mytextfile.txt. I checked the app files via X-plore on the phone and noticed it’s putting all the correct files I want in there EXCEPT the ones of type txt, is there some build setting I’m unaware of that could be filtering those files out?
I don’t know but for me it is like this,
For static (compile time) files:
I put my text file in “Assets/Resources/myfolder/level1.txt” in the unity project, build my APK and access the file with
TextAsset f = (TextAsset)Resources.Load("myfolder/" + "level1"); //notice .txt extension is removed
byte[] bytes = f.bytes;
For dynamic (added later) files:
byte[] bytes = File.ReadAllBytes(Application.persistentDataPath + "/" + "level1.txt");
Files accessed this way can be added at any time after compile time, you must check what folder that is on the device. I don’t think you can have files put here during the APK-install, that have to be done manually like you do now.