How can I access the player's inventory from server side using unity? I have the code for accessing it from the client side. Can someone please post for the server side?
How can I access the player's inventory from server side using unity? I have the code for accessing it from the client side. Can someone please post for the server side?
You can use Server API to do this. For your requirement, it would be GetUserInventory. With this method, you will need to provide the PlayFabId of the player you want to access. For example
PlayFabServerAPI.GetUserInventory(new PlayFab.ServerModels.GetUserInventoryRequest { PlayFabId = {PlayFabId} }, result => { result.Inventory.ForEach(item => Debug.Log(item.ItemInstanceId + " : " + item.DisplayName)); }, error => { Debug.LogError(error.GenerateErrorReport()); });
What you you want to return? You may use LINQ or write a foreach loop to find the items you want.
this function prints all items of the inventory for that playfab ID. I want to print certain items from the inventory i.e items of particular class or tags.
2 People are following this question.