I save/load player progress in Unity Cloud save.
Works fine in Editor. Data is loaded as it was saved. I see it in the Cloud console.
But in the web build i receive empty item. And for sure I logged as correct user - the user id checked and environment is correct.
the method
private async UniTask<T> LoadDataAsync<T>(string key) where T : class
{
var savedData = await CloudSaveService.Instance.Data.Player.LoadAsync(new HashSet<string> { key });
var wholeJson = JsonConvert.SerializeObject(savedData, _jSettings);
Debug.Log($"Loaded data for key {key}:\n {wholeJson}");
if (savedData.TryGetValue(key, out var value))
{
var valString = JsonConvert.SerializeObject(value, _jSettings);
Debug.Log($"Loaded data for key {key}:\n {valString}");
var jsonObject = JsonConvert.DeserializeObject<Dictionary<string, object>>(valString);
if (jsonObject != null && jsonObject.TryGetValue("Value", out var valuePart))
{
var valueString = JsonConvert.SerializeObject(valuePart, _jSettings);
var valObject = JsonConvert.DeserializeObject<T>(valueString);
return valObject;
}
}
Debug.LogWarning($"No saved data found for key: {key}");
return default;
}
log in the Editor
Loaded data for key ProgressData:
{
“ProgressData”: {
“Key”: “ProgressData”,
“Value”: {
“Questions”: {
“Cold”: {
…
log in browser console
UnityCloudDataProvider.cs: Loaded data for key ProgressData:
{
“ProgressData”: {}
}
I even can play in browser - create user, save some progress. Then login with this user in editor and load the progress. But the progress is empty when I load it in web build.
Why?