(Title 44B1)
Dear PlayFab Community,
Please bear with me a bit as I try to explain the scenario and what I'm hoping to do, and the behavior that I'm seeing: I have a CatalogItem X that is defined with Stackable and Durable checked. In Game Manager, I grant five of these items to my player. Let's call these ItemInstances A, B, C, D, and E.
I have a CloudScript function that makes a call to server.GetUserInventory(). [Side note: I believe that this would only return one instance of X with a RemainingUses=5, just like it does in the client.] I find my instance of X in the inventory list, and maybe it's ItemInstance B. [I do not know if it always returns the same ItemInstance for every call, but I'm guessing that it does, since the Game Manager seems to "mark" a specific instance as "Active" when they're stacked.]
In this CloudScript function, I eventually call server.ModifyItemUses() to reduce the count by 3, and then I want to update my ItemInstance's CustomData. Here's where I'm running into trouble.
I believe that when I reduce the count by 3, the system is randomly choosing which 3 ItemInstances are getting removed. Such that I will potentially lose the ItemInstance B, for which I was going to update the CustomData. I say this because sometimes I am successful in writing my CustomData, and sometimes I'm getting a failure.
If my hypothesis is correct (and I am in the process of verifying this), is there any way to ensure that a specific ItemInstance can be retained when removing instances?
Thank you in advance for any help anyone can provide!