Skip to main content

Shop Items

ShopItem prefabs visualize IAP products in your shop at runtime. These prefabs have a ShopItem2D component attached to them, which has references to every important aspect of the item - to descriptive labels, the buy button, icon sprite and so forth. Based on the product's inventory state in the DBManager, shop items show or hide different portions of their prefab instance.

Feature-ShopItem010 Feature-ShopItem020

States

Shop Items can have several different states:

StateDescriptionExample
DefaultInitial state.Feature-ShopItem030
DiscountedHighlighted.Feature-ShopItem034
PurchasedUser owns the product.Feature-ShopItem031
Single SelectUnequips other products in category.Feature-ShopItem035
Multi SelectDoes not unequip other products in category.Feature-ShopItem032
LockedRequirement not met.Feature-ShopItem036
Bundle PreviewDisplay product rewards included.Feature-ShopItem033

Setup

Item state is defined by user inventory and what references you assigned to the ShopItem component:

StateReferences
DefaultThe item needs at least descriptive labels (title/description, price) and a buy button.
DiscountedAssign a game object to the Discounted slot, which either is activated manually by enabling the Discount checkbox on the Product (in Project Settings) or automatically by doing promotional sales on third-party integrations.
PurchasedAssign a game object to the Sold slot, which gets activated on user-owned products.
Single SelectAssign the Select Button, but leave the Deselect Button empty.
Multi SelectAssign both Select Button and a Deselect Button.
LockedPrepare your prefab for the locked state first by disabling the buy button, descriptive labels etc. and showing the Locked Label and Hide On Unlock game objects. If the item gets unlocked, it hides Hide On Unlock and shows Show On Unlock assignments instead.
Bundle PreviewAssign a Preview Button.

Customization

Please note that all UI elements in Simple IAP System use Unity's default UI package. Explaining how to work with UI in Unity would be out of scope for this documentation, but if you are not familiar with it, please refer to the official documentation or video tutorials provided by Unity.