ScriptableFactoryManager

Singleton MonoBehaviour that orchestrates the runtime lifecycle of all registered ScriptableFactory instances. It initializes factories, creates ScriptableFactoryMonitor components for Inspector visibility, and handles application quit cleanup.

Definition

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

[SingletonSettings(DontDestroyOnLoad = true, InitializeOnLoad = true)]
public sealed class ScriptableFactoryManager : SingletonBehaviour<ScriptableFactoryManager>

Inheritance: ParagonBehaviourSingletonBehaviour<ScriptableFactoryManager>ScriptableFactoryManager

Remarks

The manager is configured with DontDestroyOnLoad = true and InitializeOnLoad = true, meaning it persists across scene loads and is created automatically on first access.

During Start(), it performs a three-phase initialization:

  1. InitializeFactories — Iterates all factories from ScriptableFactoryRegistry, calls Initialize() on each (which creates their runtime GameObjects), and parents them under the manager's transform for hierarchy organization.

  2. InitializeMonitors — Creates a ScriptableFactoryMonitor component on each factory's GameObject, grouped by type in an internal dictionary.

  3. StartFactories — Calls Start() on each factory, which typically pre-populates object pools.

On OnApplicationQuit(), it calls OnQuit() on all factories for cleanup.

Quick Lookup

Goal
How

Access the manager

ScriptableFactoryManager.Instance

Manager auto-creates on load

Configured via [SingletonSettings(InitializeOnLoad = true)]

circle-info

No direct API needed. The manager operates automatically. You do not need to call any methods on it — it initializes all factories and monitors on its own during Start().

Properties

No public properties. The manager's internal monitors dictionary is shown in the Inspector via [ShowInInspector] for debugging purposes.

Examples

Hierarchy at Runtime

After initialization, the Unity hierarchy will look like:

See Also

Last updated