Interface IBiomeTemplateSpawnCallbackReceiver
Implemented by any component on a BiomeTemplate's biome prefab that needs to run
custom logic when the prefab is spawned as a disconnected clone. After the clone is created, the spawner
calls OnSpawnedFromBiomeTemplate(BiomeTemplate, BiomeTemplateSpawnContext) on every component in the clone that implements this
interface (see BiomeTemplateSpawner), in GetComponentsInChildren order.
public interface IBiomeTemplateSpawnCallbackReceiver
Remarks
This is deliberately not a biome level contract. The biome component clones its own owned graph, but the prefab may carry other components that own their own references or drive their own spawn behavior, for example a helper that owns a cloned asset the biome does not, or a generator that seeds points of interest. Each such component implements this interface and handles only its own concern.
Pure runtime contract, no editor dependency. A receiver clones its owned references in memory, reassigns them to itself, and registers each clone in the context so the caller can persist them (editor) or discard them (runtime). It must never touch the AssetDatabase. Cloning is what keeps editing the new biome from mutating the template. Shared library assets stay referenced and are left alone.
Methods
- OnSpawnedFromBiomeTemplate(BiomeTemplate, BiomeTemplateSpawnContext)
React to this component's owning object being spawned from a template. Clone any owned references in memory, reassign them to this component, and register each clone in
contextfor the caller to persist.templateis the source template being instantiated. Run any other per spawn behavior here. Must not touch the AssetDatabase.