Hello everybody,
We on our project use Unity Purchasing on iOS, Andorid, Windows Mobile and even Samsung. Our new target is custom store with their own plugin. I saw that it’s possible to use Unity Purchasing with external store. But the documentation has mistakes and not clear. Unity - Manual: Registering your store
I can’t find RegisterStore method anywhere. Where is it?
Note that return type InstantiateMyStore is void.
And last: did anybody implement a separate store? Is it as easy as it looks, or I might face some big issues?
Best regards,
Vlad
@vivalavladislav Apologies, the doc appears to be out of date. The proper link is here:
https://docs.unity3d.com/ScriptReference/Purchasing.Extension.AbstractPurchasingModule.html
Here is an example implementation:
using UnityEngine.Purchasing.Extension;
namespace UnityEngine.Purchasing
{
public class SampleAppStoreModule : IPurchasingModule {
public void Configure (IPurchasingBinder binder)
{
Debug.Log ("SampleAppStore Configure");
binder.RegisterStore (SampleAppStore.Name, InstantiateSampleAppStore(binder));
}
private IStore InstantiateSampleAppStore(IPurchasingBinder binder)
{
// Check for Manufacturer. "Android" used here for the sake of example.
if(IsSupportedPlatform())
{
var sampleAppStore = new SampleAppStoreExtensionAndConfiguration();
binder.RegisterExtension<ISampleAppStoreExtension> (sampleAppStore);
binder.RegisterConfiguration<ISampleAppStoreConfiguration> (sampleAppStore);
return sampleAppStore;
}
return null;
}
private bool IsSupportedPlatform()
{
if (Application.platform == RuntimePlatform.Android)
{
return true;
}
return false;
}
}
}
@JeffDUnity3D thanks, Jeff, will try it out!