Forum Discussion

MResearch's avatar
MResearch
Member
7 months ago
Solved

Function this.world.WorldInventory.grantItemToPlayer doesn't work as expected

I have been working on the new Economy world tutorial from Horizon World Documentation and find that line 82

WorldInventory.grantItemToPlayer(player, this.props.lootSKU, this.props.lootCount);


doesn't increase the quantity of the in-world item as expected.

Here is the screenshots of the setup and debugging console messages:




Reference: https://developers.meta.com/horizon-worlds/learn/documentation/tutorial-worlds/economy-world-tutorial/module-2-setup

  • Might be a bug, but there is also a delay before purchases are reflected this way. Might need to wait a couple seconds before checking their entitlements.

    Also is your quantity value greater than 0?

6 Replies

  • eshakm.2024's avatar
    eshakm.2024
    Community Manager

    Hi MResearch, 

    This could be a bug as well, can you please file a bug through feedback hub for this issue. I have created a ticket for this for further review. 

    Thanks  

  • I have placed a report from the Desktop Editor. I am experiencing the same issue, examined and redo the steps mentioned in the tutorial a few times. still stuck at module 3 of the tutorial. Wondering anyone else encountering this?

    • Seqeq's avatar
      Seqeq
      Member

      Yes it's working now! small delay but I can move on to module 4 !

  • Might be a bug, but there is also a delay before purchases are reflected this way. Might need to wait a couple seconds before checking their entitlements.

    Also is your quantity value greater than 0?

  • I'm experiencing the same issue on my world, it was working great until yesterday. I also noticed that getting entitlement quantities always returns 0, even though the player's inventory shows the items with quantities higher than 0.