Photon Fusion 1.1.9

Public Member Functions | List of all members
INetworkObjectPool Interface Reference

Interface which defines the handlers for NetworkRunner Spawn() and Despawn() actions. Passing an instance of this interface to NetworkRunner.StartGame(StartGameArgs) as the StartGameArgs.ObjectPool argument value will assign that instance as the handler for runner Spawn() and Despawn() actions. By default (if StartGameArgs.ObjectPool == null) actions will use Instantiate(), and Despawn() actions will use Destroy(). More...

Inherited by NetworkObjectPoolDefault.

Public Member Functions

NetworkObject AcquireInstance (NetworkRunner runner, NetworkPrefabInfo info)
 The pooling implementation used for Spawn() actions.
 
void ReleaseInstance (NetworkRunner runner, NetworkObject instance, bool isSceneObject)
 The pooling handler implementation for Despawn() actions.
 

Detailed Description

Interface which defines the handlers for NetworkRunner Spawn() and Despawn() actions. Passing an instance of this interface to NetworkRunner.StartGame(StartGameArgs) as the StartGameArgs.ObjectPool argument value will assign that instance as the handler for runner Spawn() and Despawn() actions. By default (if StartGameArgs.ObjectPool == null) actions will use Instantiate(), and Despawn() actions will use Destroy().

Member Function Documentation

◆ AcquireInstance()

NetworkObject AcquireInstance ( NetworkRunner  runner,
NetworkPrefabInfo  info 
)

The pooling implementation used for Spawn() actions.

Parameters
runnerThe NetworkRunner which Spawn() is being called from.
infoMeta data about the prefab being spawned. Typical usage:
| NetworkObject AcquireInstance(NetworkRunner runner, NetworkPrefabInfo info)
| {
| if(runner.Config.PrefabTable.TryGetPrefab(info.Prefab, out NetworkObject prefab)){
| // Instantiate or Get Prefab prefab from your custom pool.
| }
| }
The primary Fusion component for networked GameObject entities. This stores the object's network iden...
Definition NetworkObject.cs:27
Represents a Server or Client Simulation.
Definition NetworkRunner.cs:30
Meta data for a NetworkObject prefab which has been cataloged in a NetworkProjectConfig....
Definition NetworkPrefabInfo.cs:8
Returns

◆ ReleaseInstance()

void ReleaseInstance ( NetworkRunner  runner,
NetworkObject  instance,
bool  isSceneObject 
)

The pooling handler implementation for Despawn() actions.

Parameters
runnerThe NetworkRunner which Despawn() is being called from.
instanceThe NetworkObject being released. Disable or Destroy this object as needed.
isSceneObjectIndicates if this GameObject was created by a Spawn action, or if it originated as an object in a loaded scene. Scene objects may need special handling, such as being returned to the scene disabled, rather than being returned to the general pool.