void GetInventory() { PlayFabClientAPI.GetUserInventory(new GetUserInventoryRequest(), LogSuccess, LogFailure); }
void GetInventory() { PlayFabClientAPI.GetUserInventory(new GetUserInventoryRequest(), LogSuccess, LogFailure); }
Each item's itemInstanceId is returned as part of the collection of ItemInstances in the Inventory property of the GetUserInventory response (https://api.playfab.com/documentation/client/method/GetUserInventory).
It's not the clearest example, but you can see how it can be done here:
Trying to use the example code from the unicorn battle for only the stuff I need, I came up with this but it gives me an error saying "No overload for for method 'GetUserInventory' takes two arguments". I am new to this kind of stuff so any help is appreciated.
public void GetUserInventory() { PlayFabClientAPI.GetUserInventory(new GetUserInventoryRequest(),(GetUserInventoryResult result) => { playerInventory.Clear(); foreach (var eachItem in result.Inventory) playerInventory.Add(eachItem); Debug.Log(playerInventory); }); }
For anybody else who is having trouble, I used this code to search the inventory to find instance Id:
public void GetInventory() { PlayFabClientAPI.GetUserInventory(new GetUserInventoryRequest(),OnGetInventory,error => Debug.LogError(error.GenerateErrorReport())); } public void OnGetInventory(GetUserInventoryResult result) { Debug.Log("Received the following items:"); foreach (var eachItem in result.Inventory) Debug.Log("Items (" + eachItem.DisplayName + "): " + eachItem.ItemInstanceId); }
2 People are following this question.