Common Workflows
These focused recipes combine the core UPFS components into common production patterns. Begin with the smallest useful configuration and add supporting systems only where the feature requires them.
Upgrade button with affordability
-
01
Read next state
Use GetNextUpgrade for the next level and gameplay value.
-
02
Read next cost
Use Economy Handler to retrieve the matching currency cost.
-
03
Set interactability
Use CanAffordNextUpgrade to enable or disable the purchase button.
-
04
Purchase
Call PurchaseNextUpgrade when the player confirms.
-
05
Refresh
Respond to purchase and Currency events instead of polling every frame.
Player-selected payment currency
csharp
List<UpgradeEconomyHandler.AffordableOption> options =
+ economy.GetAffordableOptionsForNext();
// Present options in the UI, then purchase with the player's choice.
economy.PurchaseWithCurrency(selectedCurrency);
Buy Max preview
Calculate how many sequential upgrades a balance can currently afford.
- Call GetAffordableUpgradeCount using a Currency name or ID.
- Display the returned count before the player confirms a bulk action.
- Execute purchases through the standard purchase API so balance checks, events and saves remain consistent.
- Stop when the progression is complete or the selected Currency can no longer afford the next cost.
Progress bars and milestone UI
| UI element | Source |
|---|---|
| Overall bar | Upgrade.GetOverallUpgradeProgress |
| Current group bar | Upgrade.GetCurrentBigUpgradeProgress |
| Completed counter | Upgrade.GetUpgradedSmallCount / GetTotalSmallUpgrades |
| Next cost progress | Economy.GetProgressToNextUpgrade |
| Tier icon or description | Info Provider custom fields |
Dynamic upgrade card
Combine three read models into one interface without duplicating authored data.
- Upgrade SO: current state, next level and gameplay value
- Economy Handler: costs, affordability and payment options
- Info Provider: title, description, icon, color and preview assets
- Listeners: event-driven refresh and feedback