Created
February 9, 2017 22:40
-
-
Save kaorun55/373112ee4122fe9ee58b47a339bab9ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerator Save(string filename, byte[] buffer) | |
{ | |
#if UNITY_UWP | |
var task = Task.Run(async () => | |
{ | |
StorageFolder folder = await GetStorageFolder(); | |
var file = await folder.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting); | |
using (var stream = await file.OpenStreamForWriteAsync()) | |
{ | |
await stream.WriteAsync(buffer, 0, buffer.Length); | |
} | |
}); | |
yield return new WaitWhile(() => task.Wait(1)); | |
// ファイルリストを更新 | |
yield return Update(); | |
#else | |
yield return new WaitForEndOfFrame(); | |
#endif | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment