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. | |
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().
NetworkObject AcquireInstance | ( | NetworkRunner | runner, |
NetworkPrefabInfo | info | ||
) |
The pooling implementation used for Spawn() actions.
runner | The NetworkRunner which Spawn() is being called from. |
info | Meta data about the prefab being spawned. Typical usage: | {
| 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 Meta data for a NetworkObject prefab which has been cataloged in a NetworkProjectConfig.... Definition NetworkPrefabInfo.cs:8 |
void ReleaseInstance | ( | NetworkRunner | runner, |
NetworkObject | instance, | ||
bool | isSceneObject | ||
) |
The pooling handler implementation for Despawn() actions.
runner | The NetworkRunner which Despawn() is being called from. |
instance | The NetworkObject being released. Disable or Destroy this object as needed. |
isSceneObject | Indicates 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. |