TransformPool Class

public sealed class TransformPool : ISelfCreatingNewObjectHandler<Transform>

Provides an implementation of the ISelfCreatingNewObjectHandler interface that handles Transform components.

This handler works by pooling the Transforms (which are attached to empty game objects) under a deactivated parent in the scene, and also allows you to specify a maximum number of transforms to keep in the pool. Once that limit is reached, the Transforms (and game objects) will be destroyed rather than pooled.

Methods

DespositObject(Transform)

public void DespositObject(Transform obj)

Gives a transform object to the handler for pooling or destruction.

Parameters

Name Type Description
obj Transform

The object to give to the handler.


WithdrawObject()

public Transform WithdrawObject()

Gets a transform object from the handler.

Returns

Transform
A Transform from the pool.