In-App purchasing
In the Services
tab in Unity, click on In- App Purchasing
component:
Once again flip the switch on the top right against the IN-APP PURCHASING
to enable it:
Click on the Import
button to import the IAP library:
Next, we create a new class that will handle In-App purchases; we will call this class IAPManager
.
In this add the following code. The code has been taken from the Unity example site, which has a detailed and commented code showing what each function does. The code can be accessed from https://unity3d.com/learn/tutorials/topics/ads-analytics/integrating-unity-iap-your-game:
The code has been modified for our purpose. As this is a long code, I have added comments with numbers, which I will explain later:
   using System;    using System.Collections.Generic;    using UnityEngine;    using UnityEngine.Purchasing;    public class IAPManager : MonoBehaviour, IStoreListener    {    public static IAPManager instance { set; get; }       private static IStoreController...