question

Opticgamer avatar image
Opticgamer asked

How to Display Players Invenotry In-Game

Hello, I was wondering how I would be able to display a player's inventory in-game in unity. Like a UI gets pulled up that lists all the items that the player currently has. Does anyone know how to do this in C# without static classes? I would also like to be able to select items in the inventory and remove them from the player's Playfab inventory.

apisPlayer DataPlayer Inventory
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

PlayFab provides API GetUserInventory to retrieve the player’s inventory item list in the string form, and provides ConsumeItem API to consume uses of a consumable item. You can interact with back-end game data by using these APIs.

I’m not sure why you say you need to do the UI development using C# with static classes. Do you use PlayFab C# SDK or Unity SDK? Did you refer to some tutorials?

About the advanced questions of the game UI on the client-side, you can navigate to the corresponding client-side languages’ forums for more professional technical supports. For example, if you are using Unity3D game engine, you can navigate to the official forum of Unity for richer tutorials and resources. If you are using C# language to develop the exe or UWP application, you can navigate to C# developer forums for discussions about the technical details.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Opticgamer avatar image Opticgamer commented ·

https://github.com/PlayFab/UnicornBattle/blob/master/UnicornBattle/Assets/Scripts/PF_StaticsAndHelpers/PF_PlayerData.cs#L78

I looked at the example game above and it uses static classes for getting the inventory. So I am looking for a way to do it without that. I am also using the Playfab SDK for Unity3d.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Opticgamer commented ·

The example uses the static class to make reuse easier. The static class is not required, you can modify it to the no-static class. It won’t affect the implementation of game logic. Besides, you can find rich “inventory tutorials in Unity” on YouTube or Google. You can refer to any tutorials which can meet your requirements, then use the PlayFab Inventory data instead of the sample data.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.