in v6.x to get score I was using
FB.API("/me/scores", HttpMethod.GET, LoadScoreCallback)
where LoadScoreCallback
used FBResult
. Since FBResult
has been replaced by IGraphResult
in 7.x, I am unable to get my score through it. Does anyone know how to do that?
The IGraphResult returned from an FB.API call to "/me/scores" has the scores data as you would expect in v7.x+
Here is example code for parsing the result (note: You should add error-handling):
void handleScoresResponse (IGraphResult result)
{
UnityEngine.Debug.Log(result.RawResult);
var dataList = result.ResultDictionary["data"] as List<object>;
var dataDict = dataList[0] as Dictionary<string, object>;
long score = (long)dataDict["score"];
var user = dataDict["user"] as Dictionary<string, object>;
string userName = user["name"] as string;
string userID = user["id"] as string;
UnityEngine.Debug.Log(userName + ": " + score);
}