Skip to content

💰 Currency / UI

🎯 Purpose

The UI layer provides components for displaying wallet balances across Unity UI systems.

These components are presentational only.


⚠️ Important Notes

  • UI does not modify currency state
  • UI does not own wallet logic
  • Updates are driven by ICurrencyService.OnWalletChanged
  • Behaviour depends on service resolution and composition

🧩 What Lives Here

CurrencyBar (UGUI)

  • Uses UnityEngine.UI.Text and optional Image
  • Displays balance for a bound owner and currency

CurrencyBarTMP

  • TextMeshPro variant
  • Optional auto-rebind behaviour

CurrencyBarUITK

  • UI Toolkit variant
  • Uses UIDocument and query-based binding

🧠 Usage Guidance

Shared behaviour

All components:

  • Bind to an owner and CurrencyDefinition
  • Resolve the service via CurrencyResolve
  • Subscribe to wallet change events
  • Update when relevant changes occur
  • Display 0 when unavailable
  • Rebind when service changes

Usage

  1. Create CurrencyDefinition assets
  2. Add a UI component
  3. Assign owner and currency
  4. Configure UI references

Refresh API

bar.RefreshNow();
bar.SetOwner(newOwner);

🧪 Diagnostics

  • No updates may indicate missing service or binding
  • Incorrect values may indicate mismatched owner or currency

🚫 Not for Production Use

These components are reference UI implementations and may be replaced by project-specific UI.


🧹 Safe to Remove

This folder may be removed if custom UI is used.

Currency runtime logic does not depend on UI.


  • Core — service resolution and events
  • Decorators — batch and audit events
  • Persistence — restore flows
  • Samples — UI examples