Saving and Loading - filedir?


I'm trying to save files via Application.persistentDataPath, however, the path /storage/emulated/0/Android/data//files does not exist in the headset. Thus, I cannot write nor read from the directory.

I've tried testing with PlayerPrefs, which should be in /data/data/pkg-name/shared_prefs/pkg-name.v2.playerprefs.xml but neither this exist (yet I know that PlayerPrefs do work).

I have also tried saving to:

  • "/sdcard/Android/data/" + Application.identifier + "/files";
  • //"/storage/self/primary/Android/data/" + Application.identifier;
    No file is written to the headset.

The save/load-system is tested in Editor and works on PC.

@linnea.pedersen The Magic Leap 2 uses standard Android Convention to save and load files. Make sure your application has the correct storage permissions. ("PlayerSettings->OtherSettings->WriteAccess to External(SDCard)")

How are you verifying that the file saved? Have you tried writing a script that reads back from that directory? (Application.persistentDataPath/filename.xml)

Finally, have you verified that your solution works on other Android devices, either the Android Emulator or or physical devices?

Thank you! It was the storage permission :star_struck: