Hello what is the code when I want to check whether the inventory is empty. I just can't do it
Hello what is the code when I want to check whether the inventory is empty. I just can't do it
Hey, please follow this link
I tried this code but it doesn't work GetUserInventoryRequest getUserInventoryRequest = new GetUserInventoryRequest(); PlayFabClientAPI.GetUserInventory(getUserInventoryRequest, OnGetUserInventory, OnPlayFabError); } private void OnPlayFabError(PlayFabError obj) { throw new NotImplementedException(); } private void OnGetUserInventory(GetUserInventoryResult result) { List<ItemInstance> userInventoryList = result.Inventory; foreach (ItemInstance i in result.Inventory) { if(userInventoryList.Count == 0) { SceneManager.LoadScene("IntoChoose"); break; } } }
Can you please share your ItemInstance class?
Also the API returns the data in JSON format which means you cannot simply assign the result to you variable
You need to use "JsonUtility.FromJSON<your-object-type>(pass-your-result-here)"
4 People are following this question.