Crafting — UnityIntegration / CraftingService¶
Folder Overview¶
This page documents the Unity-facing runtime service for Crafting.
CraftingService orchestrates crafting at runtime, including preflight checks, acceptance, job management, delivery, failure handling, persistence, and events.
Design Note — Unified Orchestrator (Intentional)¶
CraftingService is deliberately large. It is the single discoverable, drop-in component most projects use as-is, so the full crafting runtime surface lives in one place by design.
Independent responsibilities are already factored out — CraftingScheduler (queuing / parallelism) and CraftingJobPersistence (save / restore) — and all external behaviour is supplied through the adapters and seams (inventory, currency, authority, routing, time, RNG).
What remains here is the cohesive job-lifecycle pipeline itself, kept together for an end-to-end readable flow and a single integration point rather than split for its own sake. The runtime logic can be lifted into a host-independent core should headless use ever require it — kept inline by choice.
What Lives Here¶
CraftingService— primary runtime entry point- integration with adapters, authority, routing, time, and RNG
- Unity-facing events and queries
Purpose¶
CraftingService provides a Unity runtime host that:
- evaluates crafting requests
- consumes inputs and currency at acceptance
- manages queued and running jobs
- delivers outputs immediately or on completion
- exposes runtime state and events
It integrates with optional systems via abstractions rather than implementing them.
Usage Guidance¶
Common Entry Points¶
CanCraft/CanCraftDetailed— preflight checksEnqueue— create crafting workGetJobs— inspect runtime stateSaveActiveJobs/RestoreJobs— persistence
Runtime Model¶
The crafting pipeline is staged:
- preflight
- acceptance
- job execution
- delivery
- completion or failure
Acceptance and delivery are separate phases. Failures may occur after inputs or currency have been consumed. Recovery depends on adapter behaviour.
Dependencies¶
Required¶
ICraftingInventoryAdapter
Optional¶
ICraftingCurrencyAdapterICraftingAuthorityICraftingOutputRouterIRandomProviderITimeProviderIWallClockProvider
Fallback behaviour is applied where supported.
Important Notes¶
- service owns runtime orchestration
- behaviour depends on configured adapters and settings
- failure and refund handling are adapter-dependent
Not for Production Use¶
This service does not implement:
- inventory or currency systems
- UI frameworks
- networking or replication
These are integrated via abstractions.
Related Documentation¶
- Crafting Core (pure runtime logic)
- Crafting Contracts (data structures)
- Crafting Modifiers / Validators / Routing (extension seams)
Design Notes¶
- service-driven orchestration
- staged execution model
- adapter-based integration
This component is the primary runtime interface for Crafting within Unity.