Runtime Spawner 1.5.1
Generic Runtime spawn and instance pooling system for spawning random AI agents around a map. Works with ANY AI system easily.
Loading...
Searching...
No Matches
MegaCrush.Spawner.SpawnRequest Struct Reference

Immutable data package describing a single spawn operation. More...

Public Member Functions

 SpawnRequest (SpawnEntry entry, SpawnContext context, GameObject prefab, Vector3 position, Quaternion rotation, Transform parent=null, bool serverAuthoritative=true, bool predicted=false, object owner=null, IReadOnlyDictionary< string, object > metadata=null)
 Constructs a new SpawnRequest.
 

Public Attributes

readonly SpawnEntry Entry
 The spawn entry that defined this request (usually from a SpawnProfile or pool).
 
readonly SpawnContext Context
 Contextual information describing where and why this spawn was requested (e.g., mission, biome, runtime layer).
 
readonly GameObject Prefab
 The prefab to instantiate. This is already resolved by the spawner or executor before being passed to the factory.
 
readonly Vector3 Position
 The world-space position at which to spawn the instance.
 
readonly Quaternion Rotation
 The world-space rotation to apply to the instance.
 
readonly Transform Parent
 Optional transform to parent the spawned instance under.
 
readonly bool ServerAuthoritative
 Indicates that the authoritative simulation (e.g., server or host) should own this spawn. Used primarily by network adapters.
 
readonly bool Predicted
 Whether this spawn was predicted client-side before authoritative confirmation. Adapters that support rollback/prediction can use this to adjust behavior.
 
readonly object Owner
 Optional owner reference (such as a PlayerRef or NetworkIdentity) to assign authority over the spawned instance.
 
readonly IReadOnlyDictionary< string, object > Metadata
 Optional arbitrary metadata for factories or post-spawn systems to consume. For example, tags, custom spawn parameters, or serialized state.
 

Detailed Description

Immutable data package describing a single spawn operation.

A SpawnRequest is created by the RuntimeSpawner when it is ready to spawn a resolved prefab. The request is passed to an IObjectFactory, which performs the actual instantiation, pooling lookup, or networked spawn, depending on the adapter in use.

The struct contains both contextual information (Entry and Context) and runtime-specific parameters such as position, rotation, and optional ownership or metadata.

Because this type is a readonly struct, it is always passed by value and cannot be modified after construction.

Constructor & Destructor Documentation

◆ SpawnRequest()

MegaCrush.Spawner.SpawnRequest.SpawnRequest ( SpawnEntry entry,
SpawnContext context,
GameObject prefab,
Vector3 position,
Quaternion rotation,
Transform parent = null,
bool serverAuthoritative = true,
bool predicted = false,
object owner = null,
IReadOnlyDictionary< string, object > metadata = null )

Constructs a new SpawnRequest.

Parameters
entryThe originating SpawnEntry definition.
contextThe contextual information for this spawn operation.
prefabThe prefab to instantiate (already resolved by the executor).
positionWorld-space position for the instance.
rotationWorld-space rotation for the instance.
parentOptional parent transform for the spawned object.
serverAuthoritativeIf true, the authoritative simulation (e.g., host/server) should perform the spawn.
predictedIf true, indicates this spawn was predicted client-side and may later be reconciled.
ownerOptional owner reference for authority or bookkeeping (adapter-specific).
metadataOptional key/value metadata payload for additional parameters.

Member Data Documentation

◆ Context

readonly SpawnContext MegaCrush.Spawner.SpawnRequest.Context

Contextual information describing where and why this spawn was requested (e.g., mission, biome, runtime layer).

◆ Entry

readonly SpawnEntry MegaCrush.Spawner.SpawnRequest.Entry

The spawn entry that defined this request (usually from a SpawnProfile or pool).

◆ Metadata

readonly IReadOnlyDictionary<string, object> MegaCrush.Spawner.SpawnRequest.Metadata

Optional arbitrary metadata for factories or post-spawn systems to consume. For example, tags, custom spawn parameters, or serialized state.

◆ Owner

readonly object MegaCrush.Spawner.SpawnRequest.Owner

Optional owner reference (such as a PlayerRef or NetworkIdentity) to assign authority over the spawned instance.

◆ Parent

readonly Transform MegaCrush.Spawner.SpawnRequest.Parent

Optional transform to parent the spawned instance under.

◆ Position

readonly Vector3 MegaCrush.Spawner.SpawnRequest.Position

The world-space position at which to spawn the instance.

◆ Predicted

readonly bool MegaCrush.Spawner.SpawnRequest.Predicted

Whether this spawn was predicted client-side before authoritative confirmation. Adapters that support rollback/prediction can use this to adjust behavior.

◆ Prefab

readonly GameObject MegaCrush.Spawner.SpawnRequest.Prefab

The prefab to instantiate. This is already resolved by the spawner or executor before being passed to the factory.

◆ Rotation

readonly Quaternion MegaCrush.Spawner.SpawnRequest.Rotation

The world-space rotation to apply to the instance.

◆ ServerAuthoritative

readonly bool MegaCrush.Spawner.SpawnRequest.ServerAuthoritative

Indicates that the authoritative simulation (e.g., server or host) should own this spawn. Used primarily by network adapters.


The documentation for this struct was generated from the following file: