this is actually an child thread to my question: System.IO.IOException: Win32 IO returned 25?anyone - Questions & Answers - Unity Discussions
and Help:System.IO.IOException: Win32 IO returned 25 on my android device - Unity Engine - Unity Discussions
since the problem source has been isolated, i think might be good to start anew and focus just that, and hopefully, some of you there could offer a little hints and help me out, coz i hav stuck on this long enough to pull al my hair out
has anyone encounter that after add in “android.permission.WRITE_EXTERNAL_STORAGE”, your save feature would not work on device no more, here is my save script:
public void TB_Save()
{
if (!Directory.Exists(Application.persistentDataPath + "\\DotData"))
{
Directory.CreateDirectory(Application.persistentDataPath + "\\DotData");
}
string filePath = Application.persistentDataPath + "\\DotData\\" + "CTPDotData.Tgd";
FileStream FS = new FileStream(filePath, FileMode.Create);
XmlSerializer XS = new XmlSerializer(typeof(TBF_SaveLoad));
XS.Serialize(FS, this);
FS.Close();
Debug.Log(filePath + " Saved");
}
without android.permission.WRITE_EXTERNAL_STORAGE, my game could save no problem on both PC and Device, and adb output when saved is like:
I/Unity ( 2000): /data/data/com.CyberTurboPlays.DragFaster/files/DotData/CTPDotData.Tgd Saved
after add in android.permission.WRITE_EXTERNAL_STORAGE in anroid manifest.xml, my game could no longer save on device, PC is still OK tho, and adb output when saved is like:
I/Unity (31976): IOException: Win32 IO returned 25. Path: /storage/sdcard0/Android/data/com.CyberTurboPlays.DragFaster/files/DotData
I/Unity (31976): at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in :0
I/Unity (31976): at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in :0
I/Unity (31976): at TBF_SaveLoad.TB_Save () [0x00000] in : 0
i changed to use Application.DataPath, adb out put is like:
I/Unity (12898): UnauthorizedAccessException: Access to the path “/mnt/asec/com.CyberTurboPlays.DragFaster-1/pkg.apkDotData” is denied
guys, any suggestion is greatly appreciated