Class ConfigurationBuilder
Builds configuration for Unity Purchasing, consisting of products and store specific configuration details.
Inherited Members
Namespace: UnityEngine.Purchasing
Assembly: Unity.Purchasing.dll
Syntax
[Obsolete("This API is deprecated. Please upgrade to the new APIs introduced in IAP v5. For more information, visit the IAP manual: https://docs.unity.com/ugs/en-us/manual/iap/manual/upgrade-to-iap-v5", false)]
public class ConfigurationBuilder
Methods
AddProduct(string, ProductType)
Add a product to the configuration builder.
Declaration
public void AddProduct(string id, ProductType type)
Parameters
Type | Name | Description |
---|---|---|
string | id | The id of the product. |
ProductType | type | The type of the product. |
AddProduct(string, ProductType, StoreSpecificIds)
Add a product to the configuration builder.
Declaration
public void AddProduct(string id, ProductType type, StoreSpecificIds storeIDs)
Parameters
Type | Name | Description |
---|---|---|
string | id | The id of the product. |
ProductType | type | The type of the product. |
StoreSpecificIds | storeIDs | The object representing store IDs the product is to be added to. |
AddProduct(string, ProductType, StoreSpecificIds, IEnumerable<PayoutDefinition>)
Add a product to the configuration builder.
Declaration
public void AddProduct(string id, ProductType type, StoreSpecificIds storeIDs, IEnumerable<PayoutDefinition> payouts)
Parameters
Type | Name | Description |
---|---|---|
string | id | The id of the product. |
ProductType | type | The type of the product. |
StoreSpecificIds | storeIDs | The object representing store IDs the product is to be added to. |
IEnumerable<PayoutDefinition> | payouts | The enumerator of the payout definitions of the product. |
AddProduct(string, ProductType, StoreSpecificIds, PayoutDefinition)
Add a product to the configuration builder.
Declaration
public void AddProduct(string id, ProductType type, StoreSpecificIds storeIDs, PayoutDefinition payout)
Parameters
Type | Name | Description |
---|---|---|
string | id | The id of the product. |
ProductType | type | The type of the product. |
StoreSpecificIds | storeIDs | The object representing store IDs the product is to be added to. |
PayoutDefinition | payout | The payout definition of the product. |
Configure<T>()
Configure the store as specified by the template parameter.
Declaration
public T Configure<T>() where T : IStoreConfiguration
Returns
Type | Description |
---|---|
T | The store configuration as an object. |
Type Parameters
Name | Description |
---|---|
T | Implementation of |
Instance(object)
Create an instance of the configuration builder.
Declaration
public static ConfigurationBuilder Instance(object ignored)
Parameters
Type | Name | Description |
---|---|---|
object | ignored | No longer used parameter. |
Returns
Type | Description |
---|---|
ConfigurationBuilder | The instance of the configuration builder as specified. |
Remarks
Starting from IAP 5.0.0, this is now a singleton. This improves internal persistence across initializations, but repeated calls to UnityPurchasing.Initialize() using the same builder instance may result in duplicate product registration errors ("Same key").
If your use case requires a fresh configuration, consider using the public constructor: new ConfigurationBuilder(new PurchasingFactory());
However, this constructor may not remain public in future versions. It's recommended to avoid reinitializing IAP unless absolutely necessary.