Class ProductCatalog
The product catalog represents a list of IAP products, with enough information about each product to do a batch export for Apple's Application Loader or the Google Play CSV import format. To retreive the standard catalog, use ProductCatalog.LoadDefaultCatalog().
Namespace: UnityEngine.Purchasing
Syntax
public class ProductCatalog : object
Fields
appleSKU
The apple SKU of the app.
Declaration
public string appleSKU
Field Value
Type | Description |
---|---|
String |
appleTeamID
The apple team ID of the app.
Declaration
public string appleTeamID
Field Value
Type | Description |
---|---|
String |
enableCodelessAutoInitialization
Enables automatic initialization when using Codeless IAP.
Declaration
public bool enableCodelessAutoInitialization
Field Value
Type | Description |
---|---|
Boolean |
kCatalogPath
The path of the catalog file.
Declaration
public const string kCatalogPath = null
Field Value
Type | Description |
---|---|
String |
kPrevCatalogPath
The previous path of the catalog file used in older versions of Unity IAP.
Declaration
public const string kPrevCatalogPath = null
Field Value
Type | Description |
---|---|
String |
Properties
allProducts
The collection of all products.
Declaration
public ICollection<ProductCatalogItem> allProducts { get; }
Property Value
Type | Description |
---|---|
ICollection<ProductCatalogItem> |
allValidProducts
The collection of all valid products.
Declaration
public ICollection<ProductCatalogItem> allValidProducts { get; }
Property Value
Type | Description |
---|---|
ICollection<ProductCatalogItem> |
Methods
Add(ProductCatalogItem)
Adds an item to the catalog.
Declaration
public void Add(ProductCatalogItem item)
Parameters
Type | Name | Description |
---|---|---|
ProductCatalogItem | item | The item to be added. |
Deserialize(String)
Deserializes the catalog from JSON.
Declaration
public static ProductCatalog Deserialize(string catalogJSON)
Parameters
Type | Name | Description |
---|---|---|
String | catalogJSON | The raw json string of catalog data. |
Returns
Type | Description |
---|---|
ProductCatalog | The deserialized Prodcut Catalog. |
FromTextAsset(TextAsset)
Deserializes the catalog from a text asset.
Declaration
public static ProductCatalog FromTextAsset(TextAsset asset)
Parameters
Type | Name | Description |
---|---|---|
TextAsset | asset | The text asset. |
Returns
Type | Description |
---|---|
ProductCatalog | The deserialized Prodcut Catalog. |
Initialize(IProductCatalogImpl)
Override the default catalog implementation.
Declaration
public static void Initialize(IProductCatalogImpl productCatalogImpl)
Parameters
Type | Name | Description |
---|---|---|
IProductCatalogImpl | productCatalogImpl |
IsEmpty()
Check if the catalog is empty. A catalog is considered empty when it contains no products with valid IDs.
Declaration
public bool IsEmpty()
Returns
Type | Description |
---|---|
Boolean | A boolean representing whether or not the catalog is empty. |
LoadDefaultCatalog()
Loads the default catalog.
Declaration
public static ProductCatalog LoadDefaultCatalog()
Returns
Type | Description |
---|---|
ProductCatalog | The |
Remove(ProductCatalogItem)
Removes an item to the catalog.
Declaration
public void Remove(ProductCatalogItem item)
Parameters
Type | Name | Description |
---|---|---|
ProductCatalogItem | item | The item to be removed. |
Serialize(ProductCatalog)
Serializes the catalog to JSON.
Declaration
public static string Serialize(ProductCatalog catalog)
Parameters
Type | Name | Description |
---|---|---|
ProductCatalog | catalog | The catalog. |
Returns
Type | Description |
---|---|
String | The raw json string of the catalog data |