|
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.
|
Minimal, reusable implementation of ISpawnHandle used by the core RuntimeSpawner system.
More...
Public Member Functions | |
| BasicSpawnHandle (GameObject instance, bool isNetworked, Component netIdentity, Action< GameObject > despawnAction) | |
| Creates a new BasicSpawnHandle. | |
| virtual bool | TryGetNetworkComponent< T > (out T component) |
| Attempts to retrieve a component of type T from the spawned instance. | |
| virtual void | Despawn () |
| Executes the configured despawn action, if any, and clears the Instance reference. | |
Protected Member Functions | |
| Component | GetRawIdentity () |
| Provides direct access to the raw network identity component, if present. | |
Protected Attributes | |
| readonly Action< GameObject > | _despawnAction |
| Action invoked when Despawn is called. | |
| readonly Component | _netIdentity |
| Optional network identity or backend component associated with the instance. | |
Properties | |
| GameObject | Instance [get, protected set] |
| The spawned GameObject instance. | |
| bool | IsNetworked [get, protected set] |
| Indicates whether the instance represents a networked object. | |
Properties inherited from MegaCrush.Spawner.ISpawnHandle | |
Minimal, reusable implementation of ISpawnHandle used by the core RuntimeSpawner system.
This handle tracks a spawned GameObject and an optional network identity component, and delegates despawn behavior to a user-supplied Action<T>.
Integration adapters (e.g., Photon Fusion, PUN, or custom pooling systems) can either:
The core package never assumes a specific networking backend, keeping this type Unity-only.
| MegaCrush.Spawner.BasicSpawnHandle.BasicSpawnHandle | ( | GameObject | instance, |
| bool | isNetworked, | ||
| Component | netIdentity, | ||
| Action< GameObject > | despawnAction ) |
Creates a new BasicSpawnHandle.
| instance | The spawned GameObject instance. |
| isNetworked | Whether the instance represents a networked object. Purely informational in core. |
| netIdentity | Optional backend identity component (e.g., NetworkObject, PhotonView). Used only by derived adapters. |
| despawnAction | Action invoked when Despawn is called. May be null for manual cleanup. |
|
virtual |
Executes the configured despawn action, if any, and clears the Instance reference.
This method is safe to call multiple times; subsequent calls will no-op once Instance is null.
Implements MegaCrush.Spawner.ISpawnHandle.
|
protected |
Provides direct access to the raw network identity component, if present.
null if none.This helper exists primarily for adapter subclasses to expose backend-specific identifiers without polluting the core interface.
|
virtual |
Attempts to retrieve a component of type T from the spawned instance.
| T | The component type to query. |
| component | When this method returns, contains the requested component or null. |
true if the component exists; otherwise false.Implements MegaCrush.Spawner.ISpawnHandle.
| T | : | Component |
|
protected |
Action invoked when Despawn is called.
|
protected |
Optional network identity or backend component associated with the instance.
|
getprotected set |
The spawned GameObject instance.
Implements MegaCrush.Spawner.ISpawnHandle.
|
getprotected set |
Indicates whether the instance represents a networked object.
Implements MegaCrush.Spawner.ISpawnHandle.