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.FusionAdapter.FusionFactoryAsset Class Referencesealed

ScriptableObject factory that provides a Fusion-backed implementation of IObjectFactory. More...

Inheritance diagram for MegaCrush.Spawner.FusionAdapter.FusionFactoryAsset:
MegaCrush.Spawner.ObjectFactoryAsset

Public Member Functions

override IObjectFactory Create ()
 Creates a FusionObjectFactory bound to the resolved NetworkRunner.
 
- Public Member Functions inherited from MegaCrush.Spawner.ObjectFactoryAsset
IObjectFactory Create ()
 Creates and returns a new IObjectFactory instance.
 

Private Attributes

RunnerSource runnerSource = RunnerSource.FindInScene
 
NetworkRunner runner
 
bool serverOnly = true
 

Detailed Description

ScriptableObject factory that provides a Fusion-backed implementation of IObjectFactory.

Spawning and despawning are performed through NetworkRunner.Spawn(NetworkObject, Vector3, Quaternion, PlayerRef) and NetworkRunner.Despawn(NetworkObject), producing/consuming NetworkObject instances compatible with the RuntimeSpawner system.

When serverOnly is true, spawn requests are honored only on the authoritative host/server. Clients will not attempt local instantiation and will instead receive objects through Fusion replication. Set this to false only if you have a custom non-authoritative flow.

For optimal performance and reuse, start your runner with a pooling INetworkObjectProvider: either attach FusionPoolObjectProviderBehaviour to the NetworkRunner GameObject, or construct a FusionPoolProvider and pass it via StartGameArgs.ObjectProvider when calling StartGame. Spawning will still function with other providers, but pooled reuse will not apply.

See also
IObjectFactory, FusionObjectFactory, NetworkRunner, NetworkObject, FusionPoolObjectProviderBehaviour, FusionPoolProvider

Member Function Documentation

◆ Create()

override IObjectFactory MegaCrush.Spawner.FusionAdapter.FusionFactoryAsset.Create ( )

Creates a FusionObjectFactory bound to the resolved NetworkRunner.

Returns
A configured FusionObjectFactory if a runner is found; otherwise null.

Resolution honors runnerSource. If set to RunnerSource.FindInScene, the first active NetworkRunner in the scene is used; otherwise the manually assigned reference is required.

See also
RunnerSource

Member Data Documentation

◆ runner

NetworkRunner MegaCrush.Spawner.FusionAdapter.FusionFactoryAsset.runner
private

◆ runnerSource

RunnerSource MegaCrush.Spawner.FusionAdapter.FusionFactoryAsset.runnerSource = RunnerSource.FindInScene
private

◆ serverOnly

bool MegaCrush.Spawner.FusionAdapter.FusionFactoryAsset.serverOnly = true
private

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