Using the code below, I am able to return a single LeaderboardScore back to Unity, however what I want to do is to return scoreResults and end up with a list of LeaderboardScores in Unity.
I am not sure what type I need to specify on the Unity side to make this happen. I would assume that it would just be IDictionary<string,object>[] since Parse.Query.find returns an array of ParseObjects, however when I do that t.IsFaulted is true, but no error messages or codes are printed (I think it may be having some trouble casting to ParseException).
If someone can shed any light on what needs to be done here I would really appreciate it :)
Cloud Code
Parse.Cloud.define("getFriendsScores", function(request, response)
{
// code to get friends
var scoresQuery = new Parse.Query("LeaderboardScore");
scoresQuery.containedIn("user", parseFriends);
scoresQuery.find(
{
success: function(scoreResults)
{
response.success(scoreResults[0]);
},
error: function(scoreError)
{
console.log('No matching scores found...');
}
});
}
Unity Code
ParseCloud.CallFunctionAsync<IDictionary<string, object>>("getFriendsScores", parameters).ContinueWith(t =>
{
if (t.IsFaulted)
{
foreach (var e in t.Exception.InnerExceptions)
{
ParseException parseException = e as ParseException;
Debug.Log("Error message " + parseException.Message);
Debug.Log("Error code: " + parseException.Code);
}
}
else
{
Debug.Log("Success!");
}
});