Greetings everyone. I'm saving players progress through entity system(ID: 1DC4D). Lately I'm having trouble with it. Some players report that there is progress resets(1 or 2 entity objects won't load).
I have checked twice and none of my entity objects exceed the 1000 byte limit.
This is how I save one of the entity;
public void EntitySave() { var data = new Dictionary<string, object>() { {"Po", stats.lichPosition}, {"Rs", stats.rogueStrenght}, {"Rd", stats.rogueDexterity}, {"Rv", stats.hunterVitality}, {"Rp", stats.hunterPerception}, {"Rt", stats.rogueMissionTimer}, {"Rn", stats.rogueMissionNumber}, {"Rl", stats.rogueLevel}, {"Re", stats.rogueExperience}, {"Ra", stats.rogueStatPoint}, {"Hs", stats.hunterStrenght}, {"Hd", stats.hunterDexterity}, {"Hv", stats.hunterVitality}, {"Hp", stats.hunterPerception}, {"Ht", stats.hunterMissionTimer}, {"Hn", stats.hunterMissionNumber}, {"Hl", stats.hunterLevel}, {"He", stats.hunterExperience}, {"Ha", stats.hunterStatPoint} }; var dataList = new List<SetObject>() { new SetObject() { ObjectName = "PlayerData", DataObject = data }, }; PlayFabDataAPI.SetObjects(new SetObjectsRequest() { Entity = new EntityKey { Id = entityId, Type = entityType }, Objects = dataList, }, (setResult) => { //Debug.Log(setResult.ProfileVersion); }, OnPlayFabError); }
And this is how I load it;
public void EntityLoad1() { var getRequest = new GetObjectsRequest { Entity = new EntityKey { Id = entityId, Type = entityType } }; PlayFabDataAPI.GetObjects(getRequest, result => { JsonObject jsonResult = (JsonObject)result.Objects["PlayerData"].DataObject; object lichPos; if (jsonResult.TryGetValue("Po", out lichPos)) { stats.lichPosition = Convert.ToInt32(lichPos); } object rogueStr; if (jsonResult.TryGetValue("Rs", out rogueStr)) { stats.rogueStrenght = Convert.ToInt32(rogueStr); } object rogueDex; if (jsonResult.TryGetValue("Rd", out rogueDex)) { stats.rogueDexterity = Convert.ToInt32(rogueDex); } object rogueVit; if (jsonResult.TryGetValue("Rv", out rogueVit)) { stats.rogueVitality = Convert.ToInt32(rogueVit); } object roguePer; if (jsonResult.TryGetValue("Rp", out roguePer)) { stats.roguePerception = Convert.ToInt32(roguePer); } object rogueTimer; if (jsonResult.TryGetValue("Rt", out rogueTimer)) { stats.rogueMissionTimer = Convert.ToInt32(rogueTimer); } object rogueNumb; if (jsonResult.TryGetValue("Rn", out rogueNumb)) { stats.rogueMissionNumber = Convert.ToInt32(rogueNumb); } object rogueLvl; if (jsonResult.TryGetValue("Rl", out rogueLvl)) { stats.rogueLevel = Convert.ToInt32(rogueLvl); } object rogueExp; if (jsonResult.TryGetValue("Re", out rogueExp)) { stats.rogueExperience = Convert.ToInt32(rogueExp); } object rogueStat; if (jsonResult.TryGetValue("Ra", out rogueStat)) { stats.rogueStatPoint = Convert.ToInt32(rogueStat); } object hunterStr; if (jsonResult.TryGetValue("Hs", out hunterStr)) { stats.hunterStrenght = Convert.ToInt32(hunterStr); } object hunterDex; if (jsonResult.TryGetValue("Hd", out hunterDex)) { stats.hunterDexterity = Convert.ToInt32(hunterDex); } object hunterVit; if (jsonResult.TryGetValue("Hv", out hunterVit)) { stats.hunterVitality = Convert.ToInt32(hunterVit); } object hunterPer; if (jsonResult.TryGetValue("Hp", out hunterPer)) { stats.hunterPerception = Convert.ToInt32(hunterPer); } object hunterTimer; if (jsonResult.TryGetValue("Ht", out hunterTimer)) { stats.hunterMissionTimer = Convert.ToInt32(hunterTimer); } object hunterNumb; if (jsonResult.TryGetValue("Hn", out hunterNumb)) { stats.hunterMissionNumber = Convert.ToInt32(hunterNumb); } object hunterLvl; if (jsonResult.TryGetValue("Hl", out hunterLvl)) { stats.hunterLevel = Convert.ToInt32(hunterLvl); } object hunterExp; if (jsonResult.TryGetValue("He", out hunterExp)) { stats.hunterExperience = Convert.ToInt32(hunterExp); } object hunterStat; if (jsonResult.TryGetValue("Ha", out hunterStat)) { stats.hunterStatPoint = Convert.ToInt32(hunterStat); } }, OnPlayFabError ); }
I call save and load functions with Coroutine to avoid throttling.
IEnumerator EntityLoadThemAll() { EntityLoad1(); yield return new WaitForSeconds(1f); EntityLoad2(); yield return new WaitForSeconds(1f); EntityLoad3(); yield return new WaitForSeconds(1f); EntityLoad4(); yield return new WaitForSeconds(1f); EntityLoad5(); }
Any guidance will be super helpful.