Private Data Not Saving Using Device Based Authentication
J
Jawaad Sheikh
started a topic
almost 4 years ago
Hi,
In building my game, I was asking the user to create an account in game. I built all my code around this and was saving game data to privateData.
I switched recently to using Device Based Authentication and am finding now that I can no longer save any data to privateData. I'm wondering if there is something different I'm supposed to be doing.
Here is a sample of my cloud function called UpdateAvatar:
in my C# script in the game, I am using this code to call UpdateAvatar:
new GameSparks.Api.Requests.LogEventRequest().SetEventKey("UpdateAvatar")
.SetEventAttribute("AvatarID", Avatar_ID)
.SetEventAttribute("AvatarName", AvatarName)
.Send((response) => {
if (!response.HasErrors)
{
Debug.Log("Updated Avatar Data On GameSparks...");
}
else
{
Debug.Log("Error Updating Avatar Data...");
Debug.Log(response.Errors);
}
QueryProcessed = true;
});
Note, I do not get any error in my console. I get the "Updated Avatar Data On GameSparks message" which validates that the method is being called but when I go to explorer to look at the privateData, it is not being updated there.
Any help would be greatly appreciated.
Thanks!
1 Comment
M
Muhammad Uzair
said
almost 4 years ago
i test your code in test harness and its working fine . did you try your code in test harness?
Jawaad Sheikh
Hi,
In building my game, I was asking the user to create an account in game. I built all my code around this and was saving game data to privateData.
I switched recently to using Device Based Authentication and am finding now that I can no longer save any data to privateData. I'm wondering if there is something different I'm supposed to be doing.
Here is a sample of my cloud function called UpdateAvatar:
var AvatarID = Spark.getData().AvatarID;
var AvatarName = Spark.getData().AvatarName;
Spark.getPlayer().setPrivateData("Avatar", { "AvatarID": AvatarID, "AvatarName": AvatarName});
in my C# script in the game, I am using this code to call UpdateAvatar:
new GameSparks.Api.Requests.LogEventRequest().SetEventKey("UpdateAvatar")
.SetEventAttribute("AvatarID", Avatar_ID)
.SetEventAttribute("AvatarName", AvatarName)
.Send((response) => {
if (!response.HasErrors)
{
Debug.Log("Updated Avatar Data On GameSparks...");
}
else
{
Debug.Log("Error Updating Avatar Data...");
Debug.Log(response.Errors);
}
QueryProcessed = true;
});
Note, I do not get any error in my console. I get the "Updated Avatar Data On GameSparks message" which validates that the method is being called but when I go to explorer to look at the privateData, it is not being updated there.
Any help would be greatly appreciated.
Thanks!