question

jrDev avatar image
jrDev asked

Get Catalog Items That are Not Bundles or Containers

Hello,

I have a weird issue with my CatalogItems, I have catalog items that I am iterating through and checking to see if they are regular, bundle or container items by do this:

for(int i = 0; i < result.Catalog.Count; i++){

	if(result.Catalog[i].Bundle == null && result.Catalog[i].Container == null){

		Debug.Log(result.Catalog[i].ItemId);

	}

	if(result.Catalog[i].Bundle != null){

		Debug.Log(result.Catalog[i].ItemId);

	}

	if(result.Catalog[i].Container != null){

		Debug.Log(result.Catalog[i].ItemId);

	}

}

The problem though is that I am getting items ids that are not in Bundles or Containers returning that they are Bundles or Container items which is messing up the flow. Is this a bug or am I retrieving my categories wrong?

PS: I am using the Admin API.

Thanks,

jrDev

10 |1200

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

jrDev avatar image
jrDev answered

Hello,

This was solved with the help of a PlayFab team member @Siva Katir. Looks like the issue was with the Json being "Not Null" in the Bundles and Containers sections of specific Catalog Items. See pic:

This can only happen if writing Json by hand and not through the Game Manager. I was testing out the Unicorn Battle example from PlayFab which was initially built this way by accident (when the Game Manager UI wasn't available it seems). That section should just be:

"Container": null,
"Bundle": null

It has now been fixed and updated on Github. So in the end, the issue was definitely with my specific TitleID.

Thanks,

jrDev

10 |1200

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

Sarah Zhang avatar image
Sarah Zhang answered

We can't reproduce the behavior you said using Unity and PlayFab Unity SDK. Your code seems work fine. Could you please descript how you classified the Item Ids? We added a prefix to the Item Id, and the result is correct.

  for (int i = 0; i < result.Catalog.Count; i++)
        {
            if (result.Catalog[i].Bundle == null && result.Catalog[i].Container == null)
            {
                Debug.Log("Regular : " + result.Catalog[i].ItemId);
            }
            if (result.Catalog[i].Bundle != null)
            {
                Debug.Log("Bundle : " + result.Catalog[i].ItemId);
            }
            if (result.Catalog[i].Container != null)
            {
                Debug.Log("Container : " + result.Catalog[i].ItemId);

            }
        }
3 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.

jrDev avatar image jrDev commented ·

Hello,

Yeah, I am having the issue, maybe it is related to my Title? How can I have you test this?

Thanks,

jrDev

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

Could you please provide your TitleId for our reference? We can register a test account in your title to test this API.

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

It's solved, it was definitely the TitleID used with the Unicorn Battle example. See answer!

Thanks for help!

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.