Hi all, I am trying to figure out how the IAP system works in order to implement it. But I have a lots of question about it, just looking at the sample project and documentation doesn’t seem to be enough.
I just download the sample project > Update the iap plugin to 1.22.0 > I add a product throught the IAP Catalog window (instead of code) and then I use this piece of code ( in OnInitialized to be sure this is initializated) to show the items in the console as suggested in the “browsing products” documentation
public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
{
MyDebug("OnInitialized: PASS");
m_StoreController = controller;
m_StoreExtensionProvider = extensions;
foreach (var product in controller.products.all)
{
MyDebug(product.metadata.localizedTitle);
MyDebug(product.metadata.localizedDescription);
MyDebug(product.metadata.localizedPriceString);
}
}
However this code doesn’t show the product added throught the IAP Catalog window. If I eliminate the products added by code , it fails because there is no products available ( even 1 is added by the catalog.)
I tryed also using builder.useCatalogProvider = true;
but the result is the same
If I start a project from scratch. It only shows the catalog items if the “programatically” items are added along them. If I comment these lines
//builder.AddProduct(GOLD_50, ProductType.Consumable);
//builder.AddProduct(NO_ADS, ProductType.NonConsumable);
//builder.AddProduct(SUB1, ProductType.Subscription);
Then, no product is showed
I have some questions:
1.- Why is this happening?
2.-Also, in the documentation the manager is not a monobehaviour but in your sample project, it is. What is the best practices regards initilizating the IAP system?
3.- I have 2 scenes (menu and game) and I will like to implement IAP in both sides, Should I make a static IAPmanager?
4.- When I should initializate the IAP system? At the awake of the game, or when I want to show the IAPs?
Hope you can give more insights about how this works.
Thank you in advance and sorry about my english