Skip to content

🎮 Crafting — Unity Integration

This folder contains Unity-facing runtime components that connect the Crafting system to typical Unity scene workflows.

These components provide:

  • scene-based interaction (workbenches)
  • lightweight authority helpers
  • optional input and feedback integration

They are not part of the pure Crafting model and exist purely to support Unity-based usage.


🎯 Purpose

Unity Integration exists to bridge Crafting into real Unity scenes without requiring custom glue code.

Key goals:

  • Keep RecipeCore, CraftContext, and core contracts free of Unity dependencies
  • Provide ready-to-use MonoBehaviours for common gameplay patterns
  • Allow rapid prototyping and demo setup
  • Keep all Unity-specific behaviour outside the core crafting model

🧩 What lives here

This folder contains Unity-facing helpers such as:

Workbenches

Located under:

  • UnityIntegration/Workbenches

Provide:

  • trigger-based crafting stations (2D and 3D)
  • input-driven enqueue behaviour
  • station-tag filtering
  • optional authority gating
  • optional feedback hooks

Workbenches: - resolve recipes via RecipeResolve - call into CraftingService for all logic - do not implement crafting rules themselves


Authority helpers

Located under:

  • UnityIntegration/Authority

Provide:

  • simple MonoBehaviour implementations of ICraftingBenchAuthority

Example:

  • LocalBenchAuthority — permissive, always-true implementation for single-player setups

These are:

  • optional
  • replaceable
  • not used by CraftingService directly

⚙️ Runtime behaviour

Unity Integration components:

  • operate entirely through public Crafting APIs
  • do not access internal state
  • do not bypass adapters, validators, or modifiers
  • respect all CraftingService rules and configuration

This ensures:

  • consistent behaviour between UI-driven and world-driven crafting
  • no hidden or duplicated logic
  • predictable integration points

🌐 Authority model

Unity-facing components (such as workbenches) may optionally gate enqueue operations:

  • ICraftingBenchAuthority → local bench-level decision
  • ICraftingAuthority → global crafting mutation authority

If serverOnly is enabled on a workbench:

  • enqueue is denied unless an authority mechanism allows it

This keeps Unity interaction components compatible with:

  • single-player projects
  • server-authoritative multiplayer setups

⌨️ Input & feedback (optional)

Some Unity Integration components may depend on optional services:

  • IInputService → input handling
  • IWorkbenchFeedback → user-facing messages

These are:

  • optional
  • resolved at runtime
  • not required for core crafting functionality

If not present:

  • input may not be processed
  • feedback will be skipped safely

🧠 Design philosophy

Unity Integration follows strict boundaries:

  • Unity components orchestrate behaviour
  • CraftingService owns all crafting logic
  • adapters own external system interaction
  • no Unity-specific logic leaks into core data or contracts

This keeps the system:

  • modular
  • testable
  • predictable
  • easy to extend or replace

💡 Notes

  • Entire folder is optional
  • Safe to remove if you implement your own UI or interaction layer
  • Intended for:
  • demos
  • prototypes
  • quick in-world crafting interactions
  • Production projects may:
  • extend these components
  • replace them entirely
  • or bypass them in favour of custom UI

Summary:
Unity Integration provides optional MonoBehaviour helpers that connect Crafting to Unity scenes, while keeping all core crafting logic inside CraftingService.