IScriptableFactory

Base interface for all factories in the Scriptable Factory system. Defines the lifecycle contract (Initialize, Start, OnQuit) and provides access to the factory's runtime GameObject and Transform. Every factory — regardless of its generic parameterization — implements this interface.

Definition

Namespace: Paragon.Core.ScriptableFactory Assembly: Paragon.dll

public interface IScriptableFactory : IScriptableObject

Extends: IScriptableObject

Remarks

IScriptableFactory is the non-generic entry point for the factory interface hierarchy. The ScriptableFactoryManager uses this interface to drive the lifecycle of all registered factories at runtime:

  1. Initialize() — Called during manager startup. The factory creates its root GameObject.

  2. Start() — Called after all factories are initialized. Used for pre-warming pools.

  3. OnQuit() — Called on application quit for cleanup.

Because it extends IScriptableObject (which extends IUnityObject), any ScriptableObject that implements this interface automatically satisfies the contract.

Properties

gameObject

The factory's runtime root GameObject, created during Initialize().

transform

The Transform of the factory's root GameObject.

Methods

Initialize

Called by the ScriptableFactoryManager during runtime startup. Implementations should create the factory's root GameObject and perform one-time setup.

Start

Called after all factories have been initialized. Implementations should pre-warm the object pool here (e.g., instantiate InitialPoolSize objects).

OnQuit

Called on application quit. Implementations should perform cleanup (e.g., destroy pooled objects).

Implementation Requirements

When implementing IScriptableFactory, you MUST:

  1. Create a GameObject and assign it to gameObject during Initialize()

  2. Assign the GameObject's Transform to transform

circle-info

In practice, you should subclass ScriptableFactory rather than implementing this interface directly — it provides the standard Initialize() implementation.

See Also

  • IScriptableFactory<TObject> — adds pooling and object lifecycle

  • IScriptableFactory<TObject, TData> — adds data-driven variant spawning

  • ScriptableFactory — abstract base class implementing this interface

  • ScriptableFactoryManager — drives the lifecycle methods

  • Factory Interfaces — interface hierarchy overview

Last updated