C# Class GenericPooling, unity-pooling

A generic pooling script to control gameobject's activations and to avoid instantiate and destroy gameobjects many times.
Inheritance: BaseScript
Afficher le fichier Open project: joaokucera/unity-pooling Class Usage Examples

Méthodes publiques

Свойство Type Description
initialPoolSize int
isPoolExpandable bool
prefab GameObject

Protected Properties

Свойство Type Description
pool List

Méthodes publiques

Méthode Description
GetObjectFromPool ( Vector2 position, bool active = true ) : GameObject

Get first game object available inside of pool.

Start ( ) : void

Use this for initialization.

Méthodes protégées

Méthode Description
Initialize ( ) : void

Initialize pool.

Private Methods

Méthode Description
CreateNewObject ( ) : GameObject

Create new game object.

PrepareObjectToResponse ( GameObject obj, Vector2 position, bool active ) : GameObject

Prepare game object to response.

Method Details

GetObjectFromPool() public méthode

Get first game object available inside of pool.
public GetObjectFromPool ( Vector2 position, bool active = true ) : GameObject
position Vector2 Position to be displayed.
active bool To activate or not.
Résultat GameObject

Initialize() protected méthode

Initialize pool.
protected Initialize ( ) : void
Résultat void

Start() public méthode

Use this for initialization.
public Start ( ) : void
Résultat void

Property Details

initialPoolSize public_oe property

The initial pool size.
public int initialPoolSize
Résultat int

isPoolExpandable public_oe property

Define if pool is expadable.
public bool isPoolExpandable
Résultat bool

pool protected_oe property

A pool of game objects.
protected List pool
Résultat List

prefab public_oe property

Prefab for pool.
public GameObject prefab
Résultat GameObject