I have developed a Unity game that will be used for research purposes. The time that the player needs per level is written in a txt file. On PC it works fine. But I can't find it anywhere when I read the Oculus files with sidequest or android file transfer on my PC. I changed the permission in Unity under Project Settings -> Write Permission
to External(SD)
and added the lines in the Android Manifest.xml:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
I have also tried all possible paths (Application.dataPath
, Application.persistentDataPath
and /sdcard/filename
, /mnt/sdcard/filename
,...)
I have also restarted the Oculus several times.
This is the code I'm creating and saving the txt:
if (SceneManager.GetActiveScene().name == "Level1")
{
//Path of the file
string path = Application.dataPath + "/SteamingAssets/CoordinateTimeLog" + ".txt";
//Create file if it doesn't exist
if(!File.Exists(path)){
File.WriteAllText(path, "Path the Player walked (x,y,z) + Time in seconds\n\n");
}
//Content of the file
string content = "Level 1: " + transform.position +" "+ System.DateTime.Now + "\n\n";
//Add coordinates to it
File.AppendAllText(path, content);
}
In the AndroidManifest.xml I've added the following under </application>
:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />