Reputation: 138
I'm using Unity's in-app purchases feature to offer my game on the Google Play Store.
If I add a different in-app system to get into a new store that some users are using, I need to disable Unity's in-app purchases and use the new in-app system only for builds that get into the new store.
I disabled it through the settings, but when I actually build and run the game, the Unity in-app purchases initialisation code runs and throws an error.
My goal is to use the Unity in-app purchasing system only for builds that go to the Google Play Store, and to use the new in-app purchasing system only for new store builds. How do I disable the Unity in-app purchasing system?
At the code level, I've branched out based on builds as shown below.
using UnityEngine;
public class IAPManager : Singleton<IAPManager>
{
IIAPService _iapService;
public IIAPService IAPService => _iapService;
void Start()
{
#if GOOGLE_MARKET
Debug.Log("<color=bule>Google IAP Service</color>");
_iapService = gameObject.AddComponent<GoogleIAPService>();
#elif ONESTORE_MARKET
Debug.Log("<color=red>OneStore IAP Service</color>");
OneStoreIAPService oneStoreIAPService = gameObject.AddComponent<OneStoreIAPService>();
_iapService = oneStoreIAPService;
#else
Debug.Log("<color=green>Default IAP Service</color>");
_iapService = gameObject.AddComponent<GoogleIAPService>();
#endif
}
}
And this is the setup step for me to disable Unity in-app purchases.
Servicese -> in-app purchasing -> Configure -> DISABLE
r/Unity3D - Disable In-App Purchases Disable In-App Purchases Why is Unity's in-app purchase code consistently reset in ONESTORE_MARKET builds?
I'm new to game development at Unity, and I need your help.
Upvotes: 1
Views: 158
Reputation: 138
One of the prefabs I use included a basic example script called IAPButton. It was a very minor mistake, and I hope everyone doesn't make the same mistake I did.
Upvotes: 0