John Peterson avatar image
John Peterson asked

Granting an item resurrected a previous instance of the item that had been deleted.

Title 44B1.

Dear PlayFab community,

I have been testing the Server API with CloudScript and the various inventory-management related functions. During my testing, I've been granting myself (via Game Manager) multiple instances of an item (Stacked/Durable), setting some CustomData, and deleting instances.

I came across something very strange this afternoon: I had zero instances of this item and went to grant myself an instance via Game Manager. When it granted the item, I noticed that the CustomData element was highlighted! Sure enough, when I examined the CustomData on this newly-granted item, it had some values from an earlier test.

I am concerned that when it granted the item, it recycled one of the previous instances that I had deleted. I want to make sure that when I grant an item, it will be brand new, with no lingering CustomData.

I notice a Revoke button in Game Manager. Instead of adjusting the count of an item with system.ModifyItemUses(), should I be somehow Revoking these items, instead?

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

brendan avatar image
brendan answered

Thanks for calling this out - I've tested a number of different combinations of durables/consumables, both consuming them and revoking them. What I'm seeing is that if I revoke the item, it does look like the next time the player is granted that item, it's always a fresh stack - no carryover of CustomData. But if the item is consumed, there's a short window while the just-consumed stack is in the queue for cleanup in which, if you add another instance of that stackable item to the player, it's re-using the stack. So the count is correct, but the CustomData is carried over in that case. But that's a relatively short window of time, so you can't rely upon that - which makes it an inconsistent result. I've opened a bug on this, so that we get it fixed as soon as possible.

10 |1200

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

jwang avatar image jwang commented ·

Hi there,

Just wanted to note that I've experienced the same issue.

Easy steps to reproduce:

- Award a character an item

- At a later point, set some custom data on the item instance awarded to the character. (e.g. 'equip' info)

- "Consume" the item.

- Shortyl after, award the character the same item again.

- Observe that the custom data from the previous item instance is set on the new item instance

My workaround for now is to have clients call a cloud script to consume items, rather than using the clientAPI. The cloudscript will then consume the item, and if the remaining uses would go to '0' it will clear the custom data prior to removal of the item. Not ideal, but it works.

0 Likes 0 ·
brendan avatar image brendan jwang commented ·

As I said above, if the item has not been cleaned up after being consumed, it will be re-used. Your solution of clearing the Custom Data for the case where you're about to consume the last element from the item would work quite well for this case.

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.