Search Unity

Google Play IAP: Best Practice for Managing Non-Consumables for Virtual Currency

Discussion in 'Unity IAP' started by gdbjohnson3, Mar 3, 2019.

  1. gdbjohnson3

    gdbjohnson3

    Joined:
    Mar 11, 2018
    Posts:
    13
    I set up my store with Apple, and have put in all my store items there, including the ones you can buy with Virtual Currency. Everything works well.

    For Google Play, it seems you can't use them for Items purchasable with Virtual Currency, so I have to manage it myself. What's the best practice for this? Especially for issues of localization?

    I have been using the following structure to populate my store, where I use the returned localizedDescription from the product's meta data. For items that are virtual only, they won't have localized data. Do I have to build that out myself for Android store users?

    Code (CSharp):
    1.  
    2. _product = _storeManager.GetProduct(_storeData.ProductID);
    3. if (_product != null && _product.metadata != null) {
    4.     Debug.Log("Product retrieved by the StoreManager: " + _storeData.ItemID + ", ProductID: " + _storeData.ProductID);
    5.     ItemTitle.text = _product.metadata.localizedTitle;
    6.     ItemDescription.text = _product.metadata.localizedDescription;
    7. }
    8. else {
    9.     Debug.LogWarning("Product was not found by the StoreManager: " + _storeData.ItemID + ", ProductID: " + _storeData.ProductID);
    10.     ItemTitle.text = _gameItemData.ItemName;
    11.     ItemDescription.text = _gameItemData.ItemDescription;              
    12. }
    13.  
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    If you are not using products as defined with Unity IAP, then you would need to code it yourself. Generally developers use IAP products, like "50 Gold Coins" and charge users real money and then use it as virtual money within the game.