Search Unity

Check for purchased items with our boolean variable?

Discussion in 'Unity IAP' started by Thanitsak, Feb 13, 2019.

  1. Thanitsak

    Thanitsak

    Joined:
    Jan 4, 2016
    Posts:
    116
    In the ProcessPurchase method I set some variable for non-consuable product to be true if player bought it. In the button script after I call buying method, I have to check if the product is being bought or not, not just like press the button and some game UI changes so I check it with my variable that will only set to true in ProcessPurchase method.
    I want to know that is it ok to check if the product get bought or not by this way or I have to use another way because this won’t work?
    Also about restore is it okay to just call restore method without checking anything because I think there is already a checking in that method.
    Much appreciate!
     
    Last edited: Feb 13, 2019
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    It would work for the current session, but it will be reset the next time the player starts the game, so they won't see their previous purchases. You could use PlayerPrefs to store this information, or use some other approach for inventory management on the device. This is a feature we are considering for a future release.
     
    Thanitsak likes this.