Click or drag to resize

UNetPoolingSpawnHandler Method

[This is preliminary documentation and is subject to change.]

Spawns a GameObject that's been registered with ClientScene, with pooling support.

Namespace:  Umbrace.Unity.PurePool.UNet
Assembly:  Umbrace.Unity.PurePool.UNet (in Umbrace.Unity.PurePool.UNet.dll) Version: 0.0.0.0 (1.0.0.0)
Syntax
C#
public GameObject SpawnHandler(
	Vector3 position,
	NetworkHash128 assetId
)

Parameters

position
Type: UnityEngineVector3
The position to spawn the object at.
assetId
Type: UnityEngine.NetworkingNetworkHash128
The asset ID of the object to spawn.

Return Value

Type: GameObject
The GameObject that was spawned.
Exceptions
ExceptionCondition
ArgumentExceptionWhen assetId has not been registered with ClientScene.
Remarks

This method should be passed to the RegisterPrefab(GameObject, SpawnDelegate, UnSpawnDelegate) or RegisterSpawnHandler(NetworkHash128, SpawnDelegate, UnSpawnDelegate) methods.

Objects spawned using SpawnHandler(Vector3, NetworkHash128) should not be destroyed manually, but instead should be passed to UnspawnHandler(GameObject), to allow pooling to work. When using UNet, this means you should call UnSpawn(GameObject) instead of Destroy(GameObject).

See Also

Reference

ClientSceneRegisterPrefab(GameObject, SpawnDelegate, UnSpawnDelegate)
ClientSceneRegisterSpawnHandler(NetworkHash128, SpawnDelegate, UnSpawnDelegate)
NetworkServerUnSpawn(GameObject)