我正在构建针对Windows Store 8.1的Unity游戏,并且需要将游戏进度保存在独立存储中。但在访问本地存储使用“等待”经营者给我这个错误在独立存储中保存Unity游戏的进度
'await' requires that the type 'Windows.Foundation.IAsyncOperation<Windows.Storage.StorageFile>' have a suitable GetAwaiter method. Are you missing a using directive for 'System'?
有没有一种方法,我可以用“等待”经营者不知何故?
我想如果我在将项目导出到Windows 8.1后生成的解决方案中实现我的Save方法,它将正常工作。麻烦是我不确定如何访问主解决方案中的统一脚本的变量和方法(在保存游戏时需要)。
任何人都可以帮助任何这些方法,或者如果有更好的方法吗?
编辑: 这里是我使用的代码:
public async void save_game()
{
StorageFile destiFile = await ApplicationData.Current.TemporaryFolder.CreateFileAsync("Merged.png", CreationCollisionOption.ReplaceExisting);
using (IRandomAccessStream stream = await destiFile.OpenAsync(FileAccessMode.ReadWrite))
{
//you can manipulate this stream object here
}
}
我不认为你会得到一个答案,除非你发布代码,再现问题 – Mick 2014-09-02 02:44:40
@米克增加了代码 – Tehreem 2014-09-02 03:43:36