I'm calling UnlockContainerItem, where the container has multiple times the same loot table. Because of this, the container can grant multiple copies of the same item. In my case, the item is stackable. I'll just call it "apple".
I've noticed two peculiarities, of which I believe one is already reported and acknowledged (although reported for the GrantUserItems API: https://community.playfab.com/questions/6971/grantediteminstance-usesincrementedby-unexpected-b.html). Just to be sure, I'll describe both the issues I observed.
Firstly, when you add a stacked item instance which wasn't in your inventory before, the UsesIncrementedBy value is one too small. For example if I add two apples while the user had none before, it returns RemainingUses = 2 and UsesIncrementedBy = 1. I would expect the UsesIncrementedBy to be 2 as well. To support this, if the user had 1 apple already and you add 2 apples, it returns RemainingUses = 3, UsesIncrementedBy = 2 as expected. I believe this issue has already been recognized for GrantUserItems and the fix for that probably applies to UnlockContainerItem as well. In that case, please ignore this part of the report.
The other issue is if you had 0 apples and add 1 apple, instead of returning RemainingUses = 1 and UsesIncrementedBy = 1, it returns RemainingUses = undefined, RemainingUses = undefined. I think it should return (1, 1) which makes the result more reliable. I believe that until a stackable item has more than 1 on its stack, its stack count (or RemainingUses) simply isn't initialized.
Perhaps this table makes it easier to picture both issues.
0 + 1 = RemainingUses undefined, UsesIncrementedBy undefined (1, 1 expected)
1 + 1 = RemainingUses 2, UsesIncrementedBy 1 (as expected)
1 + 2 = RemainingUses 3, UsesIncrementedBy 2 (as expected)
0 + 2 = RemainingUses 2, UsesIncrementedBy 1 (2, 2 expected)
Note that the result of RemainingUses and UsesIncrementedBy is currently the same for 1 + 1 and 0 + 2, which makes it currently impossible to check whether the stack was newly created or if there already was a stack of 1 present. Especially due to that I hope this can be addressed! Thanks. :)