我有这种方法来保存关卡:
public void SaveLevel(string LevelName,List<CrossObject> Objs) { Debug.Log("Save Level..."); ParseObject level = new ParseObject("LevelTest"); level["Name"] = LevelName; List<ParseObject> savedList = new List<ParseObject>(); foreach (var crossObject in Objs) { var p = new ParseObject("LevelDataTest"); p["PositionX"] = crossObject.transform.localPosition.x; p["PositionY"] = crossObject.transform.localPosition.y; p["PositionZ"] = crossObject.transform.localPosition.z; p["RotationX"] = crossObject.transform.localRotation.x; p["RotationY"] = crossObject.transform.localRotation.y; p["RotationZ"] = crossObject.transform.localRotation.z; p["RotationW"] = crossObject.transform.localRotation.w; savedList.Add(p); } level["Objects"] = savedList.ToArray(); level.SaveAsync().ContinueWith(t=> Debug.Log("Level Saved.")); }
当我去解析数据时,我看到:
http://i.gyazo.com/17d0a8039105d6a38cd0f138733be8da.png
数据没问题。但是当我尝试在unity3d中加载数据时....
var load = ParseObject.GetQuery("LevelTest").WhereEqualTo("Name", LevelName);
load.FirstAsync().ContinueWith(t=>{
if (t.IsFaulted)
{
Debug.Log("Broke...");
}
else
{
Debug.Log("Loading!");
ParseObject o = t.Result;
var aux = o.GetRelation<ParseObject>("Objects").Query.FindAsync();
aux.ContinueWith(x => Debug.Log("Done!!!" + t.Result));//This is never called!}});
任何人都可以帮助我吗?