/**<summary> Load saved player data </summary>*/ public async Task Load() { string dataJson = await ServerAPI.GetPlayer(id); if (!dataJson.IsNullOrEmpty()) { Debug.Log(dataJson); try { Data playerData = JsonConvert.DeserializeObject <Data>(dataJson, ServerAPI.deserialise); if (playerData != null) { data = playerData; } } catch (Exception e) { Debug.LogError(e); } } if (data.inventory.Count == 0 && data.experience == 0) { AddDefaultItems(); } if (data.equippedItems.Count > 0) { foreach (ItemData item in data.equippedItems) { EquipItem(item); } SelectItemAsActive(data.activeItemIndex); OnActiveItemChanged?.Invoke(data.activeItemIndex >= 0 ? data.equippedItems[data.activeItemIndex] : null, data.activeItemIndex); } UpdatePlayerStats(false); }