ScriptableFactory

A type-safe object pooling and factory system built on ScriptableObjects.

Overview

ScriptableFactory provides:

  • Object Pooling — Automatic instantiation and reuse of objects

  • Type Safety — Generic factories with compile-time type checking

  • Data-Driven Design — Configure factories via ScriptableObjects

  • Variant System — Create data variants with overridable fields

  • Lifecycle Management — Spawn, despawn, and destroy with proper callbacks

Architecture

┌─────────────────────────────────────────────────────────────┐
│               ScriptableFactoryManager (Singleton)          │
│                    Manages all factories                     │
└───────────────────────────┬─────────────────────────────────┘
                            │ registers

┌─────────────────────────────────────────────────────────────┐
│                   ScriptableFactoryRegistry                  │
│               (Static database of factories)                 │
└───────────────────────────┬─────────────────────────────────┘
                            │ contains

┌─────────────────────────────────────────────────────────────┐
│              ScriptableFactory<TObject, TData>               │
│                   (Abstract factory base)                    │
│                           │                                  │
│    ┌──────────────────────┼──────────────────────┐          │
│    ▼                      ▼                      ▼          │
│ FactorablePool    DataVariantSystem      DataOverride       │
└───────────────────────────┬─────────────────────────────────┘
                            │ creates

┌─────────────────────────────────────────────────────────────┐
│  FactorableBehaviour / FactorableObject / FactorableScriptableObject  │
│                   (Poolable objects with data)               │
└─────────────────────────────────────────────────────────────┘

Quick Start

Creating a Factory

Creating a Poolable Object

Using the Factory

API Reference

Core

Objects

Pool

Spawner

Variant System

Editor

Last updated

Was this helpful?