Skip to content
Back to skills

Unity Life Economy

ASecurity

Implement Unity lives or energy regeneration with UTC refill arithmetic, offline progress, atomic paid refills, stable save IDs, attempt-level life charging, and cancellation-safe UI flows. Use for timed consumable currencies, not general economy balancing or anti-cheat.

  • 10 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 3, 2026
ai-agentsrust

Works with

  • cli

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned October 3, 2026

npx -y skills add furkantokkan/agent-foundry --skill unity-life-economy --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Unity Life Economy?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Unity Life Economy
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/furkantokkan-unity-life-economy/badge)](https://www.skillsdirectory.com/skills/furkantokkan-unity-life-economy)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: unity-life-economy
description: Implement Unity lives or energy regeneration with UTC refill arithmetic, offline progress, atomic paid refills, stable save IDs, attempt-level life charging, and cancellation-safe UI flows. Use for timed consumable currencies, not general economy balancing or anti-cheat.
---

# Unity Life Economy

Use `unity-cli` and `unity-game-dev` for the project operating contract. Read
[the economy recipe](references/mechanics.md) before changing refill math,
save transactions or retry/navigation flow. Use game-design skills when the
life-cost or pricing rules are undecided; this skill supplies implementation.

## Capture the rules

Inspect currency configuration, save schema/writer, attempt outcomes, retry,
home navigation and current tests. Record maximum, starting amount, refill
interval, paid-refill cost/currency, timer-start semantics and when an attempt
begins charging. Never copy a source game's numeric tuning.

Choose what happens when a life-charge write fails, and whether a failed
attempt's retry is free. An attempt latch set before persistence prevents
duplicate calls but can also suppress retry after failure; it does not prove
that a life was durably charged. Define the intended failure behavior.

Declare owned paths and follow save-format and serialized-asset gates. Reuse
the single app-scoped writer and typed services instead of a UI-owned wallet.
For a trusted economy, use authoritative server time and transactions; device
UTC enables offline arithmetic but is not anti-cheat.

## Implement

1. Store stable resource IDs, committed amounts and optional UTC timer starts
   in one versioned snapshot. Preserve explicit zero stock when migrating or
   loading; zero must not be mistaken for an absent/default entry.
2. Implement a pure refill function with injected time. Clamp gains at the
   maximum, retain fractional progress and stop the timer when full.
3. Advance regeneration on load and inside relevant save transactions. Keep
   a projected available amount distinct from the committed observed snapshot.
4. After spending from full, start a timer at the transaction time. Further
   spends while refilling preserve progress. Apply paid refill's payment and
   restored lives together in one candidate and one durable commit.
5. Prepare candidates under the writer lock from the latest committed state.
   Publish balances and revision only after persistence succeeds. Caller
   cancellation does not abort an already-started shared write.
6. Give attempt charging an explicit owner and phase. Prevent failure, retry
   and home from charging the same attempt again. Re-arm only when the new
   attempt is ready; route insufficient lives to the refill flow.
7. Refresh visible countdown only when its displayed value changes under the
   active view owner. No synchronous save or serialization in a gameplay tick.

## Verify and deliver

Use compile checks during development and focused tests at the final stage.
Test interval boundaries, partial progress, long offline periods, full-wallet
behavior, missing/future timestamps, spend from full, further spend, atomic
refill failure, concurrent writes and queued/started cancellation. Test life
charging across loss, failed retry, home, win, restart and persistence failure.

Report tuning, clock trust, charge-failure policy, snapshot/attempt/UI owners
and actual verification. Do not report an inspected test as a test run.

Files in this skill

  • SKILL.md3.4 KB
  • agents/openai.yaml256 B
  • references/mechanics.md4.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…