accessing instances in object array PlayFab

Im trying to understand how to access information stored in an array.

We have recently looked at playfab and are just trying to work out how it all works as they have no c# or unity documentation its been a slight challenge.

This is what we are accessing
https://api.playfab.com/Documentation/Client/method/GetUserInventory
with the following script

public void GetInventoryList()
	{	
		PlayFabClientAPI.GetUserInventory (new GetUserInventoryRequest (), OnGetUserInventoryRequest, OnPlayFabInventoryError);
	}
	public void OnGetUserInventoryRequest(GetUserInventoryResult result)
	{

		print (result.Inventory.Count);
		print (result.Inventory.Capacity);
	}

I know this is working as the .count tells me there is 5 which is how many items I have in this accounts inventory. Now im trying to access the items and what they are. Perhaps someone with better knowledge of how object arrays work can help me

This is what is stored in each object in the array
https://api.playfab.com/Documentation/Client/datatype/WebAPIModels/PlayFab.WebAPIModels.Inventory.ItemInstance?MarkOptionalProperties=False

Thanks

Hello,
The callback to PlayFabClientAPI.GetUserInventory has one parameter (GetUserInventoryResult result). This type (GetUserInventoryResult) contains a property (result.Inventory), which is a List of the player’s ItemInstances.

To view the items you can iterate over the list and log the item properties.

foreach(ItemInstance item in result.Inventory)
{
	Debug.Log(item.ItemId);
}

The documentation for this call can be found here.

Hope this helps.

Zac

The PlayFab Developer Success Team