๐บ๏ธ 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 ofIAPItem
entries: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
useFakeShopOnPC
is 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
UIFakePurchaseConfirm
Simulates 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