Multi Currency View maps supplied Currency amounts to child Currency Views. Use a Currency Owner Monitor for a live wallet balance; let a Shop, Recipe Panel, Item View module or project component supply contextual prices/costs.

Create and map Currency Views

Prepare Gold in the active Inventory System Database, an Icon when needed and a Currency Owner with a known balance. Use a project-owned UI Designer schema.

  1. Open Tools > Opsive > Ultimate Inventory System > UI Designer > Currency > Create.
  2. Choose Multi Currency View, Multi Currency View Small, Currency Owner Monitor or a single Currency View.
  3. Set Parent Transform and create.
  4. In Currencies With Views, map Gold to its child Currency View. Every entry needs valid Currency/View references from the intended database and UI.
  5. Assign the child’s Text and optional Image. Keep Hide If Zero Off when a visible zero and fixed alignment are desired.

Multi Currency View Inspector mapping configured Currencies to their corresponding Currency View components.

Currency View field Default Purpose
Text Unassigned manually Required integer amount display.
Image Optional Uses the supplied Currency’s Icon.
Hide If Zero Off On deactivates the child’s GameObject at zero; a nonzero value activates it again.

Currency View Inspector with Hide If Zero, Image, and Text references for one displayed Currency.

Arrange the child hierarchy/layout to match the denomination order. Zero hiding suits layouts that should collapse unused values; keep zeros visible when the row should maintain its width.

Bind one deliberate data owner

Display Supplier
Player wallet Currency Owner Monitor, drawing its Currency Owner’s collection.
Selected shop quantity’s total Shop Menu’s calculated collection.
Recipe cost Crafting Menu/Recipe Panel.
Raw Item price Attribute Currency Item View inside an Item View.
Reward or custom total Project code supplying a collection/amount array.

For a balance, choose Currency Owner Monitor in the designer. Assign Multi Currency View, or allow its same-GameObject lookup. Inventory ID initially 1 resolves that Inventory Identifier’s Currency Owner when no direct owner is assigned. A direct Currency Owner takes priority; use ID 0 to disable ID lookup.

Currency Owner Monitor uses Inventory ID zero, Player Inventory as Currency Owner and Gold Balance as Multi Currency View.

The monitor initializes at Start, subscribes to owner updates and draws immediately. Use notifying Currency Owner/collection APIs for later mutations. When switching live players, have the binder call SetCurrencyOwner(newOwner) explicitly after the monitor and its View are initialized. Use distinct player IDs and verify the resolved owner in split-screen/spawned UI.

A price-only View should be driven by its menu/module. Put the wallet monitor on a separate balance View so it does not overwrite a shop or crafting total.

Choose denominations and price presentation

For Gold-only pricing, map just Gold. For independent Currencies, give each its own mapping. A supplied Currency Collection draws each stored denomination; an absent amount becomes zero and follows the child’s zero-hiding policy.

For a convertible Bronze/Silver/Gold family, configure conversion/overflow/fraction rules in the Currency model, then map every denomination to display. Multi Currency View reads the collection’s stored amounts. An amount-array input matches exact Currency references and supplies zero for missing entries. Calculate/normalize a single converted total before drawing when that is the desired presentation.

To show wallet and shop price together, use two Views. Bind the wallet monitor to the player. Give Iron Sword a CurrencyAmounts Attribute named BuyPrice, containing 50 Gold, and configure Shop Menu’s Buy Attribute Name and total-price View. Change quantity to update the total; a completed purchase should notify the wallet owner and update the balance separately.

The native Currency Owner Monitor shows 45 Gold and zero Silver and Bronze after adding 50 Gold, spending 10 and awarding five.

This native monitor starts at 50 Gold, redraws after removing 10, then redraws at 45 after adding five. Silver and Bronze remain zero.

Verify redraw and ownership

Start with 100 Gold. Open the UI and confirm that balance, add/remove Gold through notifying APIs and verify automatic redraw. Test zero with Hide If Zero off/on. For several Currencies, supply a collection and an exact-amount array and compare missing-denomination behavior.

Select Sword in Shop: price should show 50 while the wallet shows its balance. Change quantity, complete an affordable purchase and compare the displayed total with the balance/Inventory changes. Reject an unaffordable purchase without changing either. Repeat with each local player’s owner and after runtime rebinding.

Symptom Check Fix
Empty amount display Mappings, required Text and value supplier. Connect valid Currency/Views and draw through the intended owner.
Zero/wrong player’s balance Direct owner, Inventory ID and duplicate IDs. Bind the matching Currency Owner explicitly.
Data changes without redraw Monitor activation/reference and notifying mutation. Keep the balance monitor active and use supported update APIs.
Amount disappears at zero Hide If Zero. Disable it for a stable visible zero.
Price becomes wallet balance Monitor on the price View. Keep balance and contextual-price ownership separate.
Array lacks a converted denomination Exact-reference input and Currency rules. Supply that Currency or normalize the value before drawing.

Developer reference

Draw a collection for its stored denominations or an array of explicit amounts:

multiCurrencyView.DrawCurrency(currencyOwner.CurrencyAmount);
multiCurrencyView.DrawCurrency(new[] {
    new CurrencyAmount(gold, 50),
});

multiCurrencyView.SetTextColor(Color.white);
multiCurrencyView.DrawEmptyCurrency();

Null input sets mapped children to CurrencyAmount.None, displaying zero when zero-hiding is off. DrawEmptyCurrency() instead calls each child’s Clear, leaving empty text or a hidden GameObject. Assign valid Text references for color methods and at least one mapping before GetTextColor, which reads the first child.

currencyView.SetValue(new CurrencyAmount(gold, 50));
currencyOwnerMonitor.SetCurrencyOwner(currencyOwner);

The monitor removes owner-event subscriptions on rebinding and destruction. Multi Currency View and its child Views own presentation; use Currency Owner Saver for wallet persistence and synchronize the authoritative Currency Owner before notifying/redrawing local network UI. See Shop Menu, Crafting Menu and Item View.