Skip to content

🔌 Crafting — UnityIntegration / Dependency Binding

📦 Folder Overview

This page documents how inspector-assigned dependencies are resolved at runtime.

Binding is handled by CraftingDependencyBinder.


🧩 What Lives Here

  • dependency resolution logic for CraftingService
  • fallback handling for optional systems
  • validation and warning emission for inspector assignments

🎯 Purpose

Dependency binding translates Unity inspector references into runtime interfaces.

It ensures:

  • correct interface resolution
  • safe fallback behaviour
  • clear warnings for invalid assignments

🧠 Usage Guidance

Resolution Rules

Each dependency follows this process:

  1. attempt to cast assigned object to expected interface
  2. if valid → use it
  3. if invalid → warn and fallback (if supported)
  4. if missing → fallback or permissive behaviour

Required Dependency

  • ICraftingInventoryAdapter

If missing or invalid, crafting cannot proceed.


Optional Dependencies

  • ICraftingCurrencyAdapter
  • ICraftingAuthority
  • ICraftingOutputRouter
  • IRandomProvider
  • ITimeProvider
  • IWallClockProvider

⚙️ Fallback Behaviour

Random Provider

  • deterministic mode → SeededRandomProvider
  • otherwise → UnityRandomProvider

Time Provider

  • fallback → UnityTimeProvider

Wall Clock

  • fallback → SystemWallClock

Authority

  • not assigned → permissive mode
  • invalid → warning + permissive mode

Currency Adapter

  • optional
  • if absent → currency checks are skipped

⚠️ Important Notes

  • binding is setup-only and runs during initialization
  • behaviour depends on assigned components and fallback rules
  • warnings indicate configuration issues

🚫 Not for Production Use

Binding does not perform:

  • crafting logic
  • job execution or scheduling
  • persistence or validation

  • Crafting UnityIntegration (runtime layer)
  • Crafting Core (execution behaviour)

🧠 Design Notes

  • fail-safe setup through fallback behaviour
  • explicit warnings over silent failure

This layer ensures inspector configuration results in predictable runtime behaviour.