- Home /
How to load plist file into APK (Android) with Unity?
I'm working on a multi platform game and am trying to load a "plist" (or "txt" for iOS) file into the APK with Unity. I can't figure out to what directory that file has to be put in order to have it in the APK file after building the APK with Unity.
As for the iPhone version the file is being set in
Application.dataPath + "/../" + "levels.txt";
and it works like that. However, to which path has this file to be set in order to make it appear in the Android APK file? I've tried various sub paths already but in no case the plist file appeared within the APK file afterwards.
Thanks for any helpful hints.
Answer by Paulius-Liekis · Jan 02, 2012 at 12:33 PM
Why can't you access file as TextAsset? - just create TextAsset property in your script. Drag and drop the file into the property, and then you can access contents by doing myTextAssetProperty.text
Answer by taar1 · Jan 05, 2012 at 09:38 AM
Thanks a lot. That actually worked wonderfully!
You shouldn't post comments as answers (you should post them as comments ins$$anonymous$$d). And please mark my answer as correct if it solves your problem (it helps others to see that the question is answered). And welcome to Unity Answers! ;)
Your answer
Follow this Question
Related Questions
Can't find OBB when downloaded from Play Store on some devices (4.3.1) 1 Answer
cannot build apk :/ windows 8 and android SDK 0 Answers
UnityException: APK Builder Failed! 0 Answers
Help!How can I build a Unity3d project for x86? 0 Answers
Android - Design your app for tablets optimization tip on Google Play 0 Answers