【发布时间】:2014-12-02 11:45:01
【问题描述】:
我正在使用 Unity 和 Parse.com 进行游戏开发。我想弄清楚我在保存后立即检索了 objectId。我试过这个:
ParseObject myGame = new ParseObject("Games");
myGame["score"] = 223;
myGame["playerName"] = "Michael";
Task saveTask = myGame.SaveAsync().ContinueWith(t => {
ParseObject theObject = t.Result;
string newObjectId = theObject.objectId;
});
我在 t.Result 上收到错误消息:
Type `System.Threading.Tasks.Task' does not contain a definition for `Result' and no
extension method `Result' of type `System.Threading.Tasks.Task' could be found (are
you missing a using directive or an assembly reference?)
可以这样或那样做吗?
任何帮助表示赞赏并提前感谢:-)
【问题讨论】:
-
this is because Task does not have Result property -
好的,那么保存后我无法立即取回 ObjectID 吗?那我需要创建一个新请求吗?
-
尝试删除带有 t.Result 的行并在下一行使用 myGame.objectID
-
@Reniuz 我收到一个错误 - 错误 CS0246:找不到类型或命名空间名称“任务”。您是否缺少 using 指令或程序集引用?你能帮我解决这个问题吗?
-
添加
using System.Threading.Tasks;
标签: c# multithreading unity3d parse-platform