如何在保存ParseObject后立即检索objectId

时间:2015-02-18 07:46:48

标签: unity3d parse-platform

我正在使用Unity和Parse.com进行游戏开发。我试图找出如何在保存后立即检索objectId。我试过这个:

using UnityEngine;
using System.Collections;
using Parse;
public class ParseTestScript : MonoBehaviour {
string objectId ;   
ParseObject testObject;

void Start ()
{
    AddTheScore ();
}

void AddTheScore()
    {
    testObject = new ParseObject("ParseTest");
    testObject["score"] = 2332;     
    Task saveTask = testObject.SaveAsync().ContinueWith(t => {          

        objectId = testObject.objectID ;

    });
              Debug.Log(objectId );
    }


}

我收到了错误消息 -    error CS0246: The type or namespace name "Task" could not be found.Are you missing a using directive or an assembly reference?

任何帮助都表示赞赏,并提前致谢。

我按照这个链接 https://stackoverflow.com/questions/27248622/how-to-retrieve-objectid-right-after-save#=

1 个答案:

答案 0 :(得分:1)

您需要为任务添加命名空间:

using System.Threading.Tasks;