Reward coins on watching video ad



  • I want to grant a coin bonus when player will watch the rewarded video.

    How can I implement it?

    I have next row in SIS IAP Settings.

    alt text

    If I purchase the product then coins are spent, obviously.

    Yes, I can get the "price"(bonus) with IAPManager.GetIAPObject(id) and use DBManager.IncreaseFunds(), but what the best practice in this case?



  • Please see this existing thread.

    https://www.rebound-games.com/forum/topic/1801/code-to-unity-ads-get-free-coins

    You would be using DBManager.IncreaseFunds in your "ad watched successfully" callback, there is no need to define a product.



  • @Baroni said in Reward coins on watching video ad:

    Please see this existing thread.

    https://www.rebound-games.com/forum/topic/1801/code-to-unity-ads-get-free-coins

    You would be using DBManager.IncreaseFunds in your "ad watched successfully" callback, there is no need to define a product.

    Ok, got it.

    But It would be more convenient when there is only place to store info about IAPs, coins, bonuses, etc. It's more natively way as I see. It's my feature request.

    So I prefer to store my bonuses info in SIS IAP Setting and will use next function to get the price (I needed to investigate your source code to write it because I couldn't find something like that):

    private int GetCoinPrice(string id)
            {
                var virtualPrice =
                    IAPManager.GetIAPObject(id)?.virtualPrice;
    
                if (virtualPrice != null)
                {
                    for (int i = 0; i < virtualPrice.Count; i++)
                    {
                        if (string.Equals(
                            virtualPrice[i].name,
                            coinsCurrencyName,
                            StringComparison.Ordinal))
                        {
                            return virtualPrice[i].amount;
                        }
                    }
                }
    
                // Provide Safe Prices if no virtualPrice
    
                if (string.Equals(
                    IAPManager.GetIAPObjectGroupName(id),
                    groupNameBonuses,
                    StringComparison.Ordinal))
                {
                    return 0;
                }
                else
                {
                    return int.MaxValue;
                }
            }
    


  • @andrewio said in Reward coins on watching video ad:

    But It would be more convenient when there is only place to store info about IAPs, coins, bonuses, etc.

    Simple IAP System is designed to hold in-app purchases. Products or items that can be bought or displayed in a shop. For game specific scenarios we provide a wide range of public methods on the IAPManager, DBManager and ShopManager.

    If we take Super Mario as an example, you are basically requesting the ability to add a "coin" or "mushroom" product to the IAP Settings editor. These are not items that exist in a shop, they only exist in your game. If you would add them to the IAP Settings editor, you would need a separate group without container or prefab assigned in any scene. They are something your game needs to handle, not this asset.

    This is not going to be added.


Log in to reply