Scriptable Objects
Scriptable Objects Overview
The Runtime Spawner and its related systems use ScriptableObjects (SOs) to store configuration data, presets, and modular behaviors.
These assets make it easy to define reusable profiles for spawns, regions, encounters, and factories - keeping scene setups clean and consistent.
Why ScriptableObjects?
Separation of Data and Logic – configuration lives outside the scene, so you can edit or share it safely.
Lightweight and Serializable – assets load quickly and consume minimal runtime memory.
Reusability – the same settings can be used across multiple scenes, prefabs, or projects.
Version-Controlled – changes are easy to track and merge in source control.
The Runtime Spawner framework uses ScriptableObjects for nearly all user-facing configuration: spawn rules, hint settings, population libraries, and factory definitions.
Core ScriptableObject Types
Spawner Configuration
Spawn Entry
Defines what prefabs can spawn, with counts, probabilities, and grouping.
Hint System
Spawn Hint Settings
Controls how EnemySpawnHintPoint markers are used and filtered.
Region System
Region Spawn Library
Contains per-region spawn lists and step-based rules for population control.
Special Encounters
Special Encounter Profile
Manages rare encounter definitions and their spawn conditions.
Factory System
Factory Assets (SinglePlayerPoolFactoryAsset, FusionFactoryAsset, PUNFactoryAsset)
Define how objects are instantiated (local, Fusion, PUN, or custom).
Diagnostics / Telemetry
Telemetry Settings
(Optional) Controls runtime diagnostics and debug visibility.
Each category represents a modular system within the Runtime Spawner; together they form a flexible, data-driven workflow.
Typical Workflow
Create the necessary ScriptableObjects using the Create → Megacrush → Spawner menu.
Assign them to the appropriate scene components (e.g., RuntimeSpawner, RegionPopulationController).
Adjust parameters in the inspector to control density, randomness, or behavior.
Share or Reuse them across scenes for consistent tuning.
Extending the System
You can add new configuration assets by subclassing ScriptableObject.
Most major systems (Spawner, Factory, Region) already expose clear extension points and interfaces to integrate your own data types.
Example: Derive from
ObjectFactoryAssetto add a new network or pooling backend, or fromSpawnProfileBaseto create custom spawn tables.
Related Pages
In short: ScriptableObjects are the backbone of the Runtime Spawner configuration system - a clear, modular way to define what spawns, where it spawns, and how it’s instantiated, all without touching scene logic or code.
Last updated