I am trying to use windows.storage namespace and trying to drop a file in Streaming asset in unity.
The Unity StreamingAssets folder is read-only and used to store Assets. For specific instructions, please see the Unity official doc: Application.StreamingAssetsPath .
Therefore, I suggest you save the file in the Application.persistentDataPath and note that source files have read and write permissions.
To move the file from the objects3D folder to the persistentDataPath folder, you can try the following code:
#if ENABLE_WINMD_SUPPORT
var objectPath = KnownFolders.Objects3D.Path;
string path = Path.Combine(objectPath, "MyFile.txt");
string targetPath = Path.Combine(Application.persistentDataPath, "MyFile.txt");
using (TextWriter writer = File.CreateText(path))
{
writer.WriteLine("test");
}
File.Move( path, targetPath);
#endif
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.