0
\$\begingroup\$

I am looking at implementing the new Unity In App Purchasing API for the first time.

Through the guide and the tutorial, I see that there is the ability to add different store identifiers for product ids that vary across stores... and all the examples reference that way of doing it.

Eg.:

public class MyIAPManager {
    public MyIAPManager () {
        var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
        builder.AddProduct("100_gold_coins", ProductType.Consumable, new IDs
        {
            {"100_gold_coins_google", GooglePlay.Name},
            {"100_gold_coins_mac", MacAppStore.Name}
        });
    }
}

In my case, my product id's DONT differ, so this seems like unnecessary code bloat to implement it this way... but I don't see any other option?

EDIT

Argh, I'm using VS Code on OS X, which is getting better, but still has issues, such as having problematic code-completion / API referencing issues, so didn't see the overloaded method option... It's simply enough to do this:

var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.AddProduct("100_gold_coins", ProductType.Consumable);
\$\endgroup\$
0
\$\begingroup\$

There is an overloaded method that simply skips the optional Array of IDs if unnecessary... See Edit to OP.

var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.AddProduct("100_gold_coins", ProductType.Consumable);
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.