🗺️ MonetizationManager
MonetizationManager – Component Overview
The MonetizationManager handles all in-app purchases (IAP) in the Virtual Pet Game Template. It supports consumable products, visual IAP data, and a fake purchase window for desktop and WebGL testing.
💰 What It Does
Initializes Unity IAP using the local Product Catalog
Handles real or fake purchases depending on the platform
Applies rewards (coins) based on configured product payouts
Displays a fake confirmation dialog when testing on PC/WebGL/Editor
Allows developers to localize product titles and assign icons per product
🔧 Inspector Fields
IAP Product Visual Data
iapVisualData– List ofIAPItementries:productId: ID from the IAP catalogproductIcon: Sprite used in the store UItitleTranslated: NameTranslatedByLanguage[] for title localization
Testing
useFakeShopOnPC– If enabled, shows a fake purchase dialog in non-mobile builds.
🛒 Runtime Behavior
Purchase Flow
To trigger a purchase:
If the build is mobile: opens native store UI
If running on PC/WebGL and
useFakeShopOnPCis enabled: shows fake shop popup
Purchase Rewards
When a product is purchased, its payouts are parsed.
If payout type is
Currency, the corresponding coin is added toPlayerSave
🧪 Fake Shop (Testing)
Used on Editor, WebGL, or PC if useFakeShopOnPC is true:
Opens a confirmation popup using
UIFakePurchaseConfirmSimulates a payout (adds coins)
Useful for testing IAP visuals and logic without mobile store setup
🌍 Localization & Icons
GetTranslatedTitle(productId)– Returns localized title for a productGetIconForProduct(productId)– Returns icon assigned iniapVisualData
✔️ Supported Platforms
Mobile platforms (iOS, Android) – real purchases
Editor, WebGL, Desktop – fake shop fallback (optional)
This component provides a fully customizable, offline-compatible IAP integration with localized UI support and safe fallback for development environments.
Last updated