Unity IAP 提供快速简单的工具来创建和导出__商品目录__ (Product Catalogs)。使用 Unity Editor 的 IAP Catalog 窗口可填写__商品__元数据,然后将目录导出到开发者控制面板 (Developer Dashboard) 以配置每个商品的广告素材资源。请注意,也可以在控制面板中手动将商品添加到目录中,如下所述。
在 Editor 中,选择 Window > UnityIAP > IAP Catalog 以打开 IAP Catalog 窗口。该 GUI 列出了以前配置的所有__商品__,并允许您为每个商品定义以下属性:
注意:__商品目录__必须至少配置一个__商品__才能导出。有关设置商品的完整过程,请参阅有关 Codeless IAP 的文档。
您可能已经使用构建器 (builder) 脚本为 Unity IAP 填充了商品目录。例如:
var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.AddProduct(product_coins, ProductType.Consumable);
builder.AddProduct(product_hat, ProductType.NonConsumable);
builder.AddProduct(product_elite, ProductType.Subscription);
因为内购推荐 (IAP Promo) 仅支持从 Editor IAP Catalog GUI 导出 JSON,所以我们建议按如下方式修改您的方法:
builder.AddProduct()
代码。StandardPurchasingModule module = StandardPurchasingModule.Instance();
ProductCatalog catalog = ProductCatalog.LoadDefaultCatalog();
ConfigurationBuilder builder = ConfigurationBuilder.Instance(module);
IAPConfigurationHelper.PopulateConfigurationBuilder(ref builder, catalog);
UnityPurchasing.Initialize(this, builder);
在 IAP Catalog 窗口中,选择 App Store Export > Cloud JSON 以导出商品目录的本地副本。
在开发者控制面板 (Developer Dashboard) 的 Operate 页面上配置商品目录 (Product Catalog)。当前操作的项目会出现在左上角。要管理商品,请从左侧导航栏中选择 Monetization > In-App Purchases。
可以手动填充商品,也可以通过导入 JSON 文件批量填充商品。
从控制面板的商品配置菜单 (Monetization > In-App Purchases) 中,单击右上角的 ADD NEW PRODUCT 按钮,然后输入以下详细信息:
单击 SAVE 按钮可将商品存储到目录中。
要设置新的__商品目录__或更新目录中的现有__商品__:
导入的__商品__将出现在 Product Catalog(商品目录)列表中。但是,为了符合__推荐 (Promotions)__ 的条件,每个__商品__必须具有关联的创意资源(否则__广告位__无法显示任何内容)。
要添加创意资源,请遵循以下步骤:
从 Product Catalog 列表中选择一个__商品__,然后向下滚动到 Creative Uploads 部分。
注意:虽然每个商品的 __Product ID__(商品 ID)、Name(名称)、Price(价格)和 Type(类型)显示在控制面板中,但是只能从 Unity Editor 的 IAP Catalog 窗口中编辑这些属性。
要为不同区域指定独特的创意资源,请选择 ADD LANGUAGE,然后选中要包含的语言。
注意:下拉列表会显示正在编辑的当前语言。如果添加的语言没有创意资源,则会默认使用其 English (United States)(美国英语)创意资源。
选择 UPLOAD CREATIVE 以便上传创意资源。左侧会显示预览。
选择 SAVE 以继续。返回到 Product Catalog 页面后,__商品__现在__符合推荐条件 (Promotion-eligible)__,如 Creative Attached 列所示。
注意:还必须将__商品目录__提交到相应的 Google Play 或 iTunes 应用商店,才能执行购买流程。请参阅有关 Codeless IAP 的文档中的导出部分。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.