I SERIOUSLY CANNOT FIND ANY TUTORIAL ANYWHERE THAT IS CLEAR ON HOW TO USE IT,I SERIOUSLY CANNOT FIND ANY TUTORIAL ANYWHERE
I SERIOUSLY CANNOT FIND ANY TUTORIAL ANYWHERE THAT IS CLEAR ON HOW TO USE IT,I SERIOUSLY CANNOT FIND ANY TUTORIAL ANYWHERE
You can refer to my testing example code, It will print out the item ID from the currently logged in player's inventory.
void Start()
{
var request = new LoginWithPlayFabRequest { Username = "", Password = "" };
PlayFabClientAPI.LoginWithPlayFab(request, OnLoginSuccess, OnLoginFailure);
}
private void OnLoginSuccess(LoginResult result)
{
Debug.Log("login successful!");
TestGetUserInventory();
}
public void TestGetUserInventory()
{
PlayFabClientAPI.GetUserInventory(new PlayFab.ClientModels.GetUserInventoryRequest()
{
},
result => {
Debug.Log("Get User Inventory successful");
foreach (var item in result.Inventory)
{
Debug.Log("Item: " + item.ItemId);
}
},
error => {
Debug.Log("Got error getting user Inventory");
Debug.Log(error.GenerateErrorReport());
});
}
private void OnLoginFailure(PlayFabError error)
{
Debug.LogWarning("Something went wrong with login API call. :(");
Debug.LogError(error.GenerateErrorReport());
}
Could you tell us which economy you are using? Legacy Economy or Economy v2? In Legacy Economy, you can call API GetUserInventory to retrieve the specified user's current inventory of virtual goods. For more info, you can refer to Economy (Legacy) quickstart - PlayFab | Microsoft Learn. In Economy v2, you can retrieve player’s inventory via API GetInventoryItems. For more details, please refer to Player Inventory Quickstart - PlayFab | Microsoft Learn.
1 Person is following this question.