Hello! So silly me decided to try to update the PlayFab SDK in advance of our launch (by the end of the month). But apparently this was a very stupid mistake.
Pretty much all of the functions that are related to cloud script just suddenly stopped working. For example:
void GetInfoFromIDCallback (RunCloudScriptResult result)
{
//Debug.Log(result.ResultsEncoded);
JsonObject values = (JsonObject)result.Results;
object container;
values.TryGetValue("messageValue", out container);
string faceID = "";
if (result.ResultsEncoded.Contains("FacebookInfo"))
{
faceID = ((UserAccountInfo)container).FacebookInfo.FacebookId;
// faceID = values["messageValue"]["UserInfo"]["FacebookInfo"]["FacebookId"].ToString();
}
.
.
.
This used to work very simply by just adding these 2 lines
Dictionary<string, JToken> values = JsonConvert.DeserializeObject<Dictionary<string, JToken>>(result.Results.ToString());
faceID = values["messageValue"]["UserInfo"]["FacebookInfo"]["FacebookId"].ToString();
The cloudscript result, just holds the AccountInfo that was request in the server.
I thought with serialization would be easier to cast object from the Client Models than before so I should be able to just cast it as it is. But heres the error:
InvalidCastException: Cannot cast from source type to destination type.
I have tried this:
string jsonData = PlayFab.SimpleJson.SerializeObject(container);
UserAccountInfo account = PlayFab.SimpleJson.DeserializeObject<UserAccountInfo>(jsonData);
but it just creates a UserAccountInfo with null values.
Right now, am clueless, and I have no idea what I should. Anyone can give me a hand?? Why was this change so big?? (I tried changing to ExecuteCloudScript, but decided not too since nothing is working at all right now).
A little frustrated... thanks in advance.