https://github.com/densylkin/QuickPool
Simple pooling toolkit for Unity game engine
https://github.com/densylkin/QuickPool
Last synced: 7 months ago
JSON representation
Simple pooling toolkit for Unity game engine
- Host: GitHub
- URL: https://github.com/densylkin/QuickPool
- Owner: densylkin
- License: mit
- Created: 2015-10-10T22:17:21.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-30T10:28:11.000Z (over 9 years ago)
- Last Synced: 2024-11-10T17:45:15.690Z (about 1 year ago)
- Language: C#
- Homepage:
- Size: 1.5 MB
- Stars: 32
- Watchers: 5
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-opensource-unity - QuickPool - Simple pooling toolkit for Unity game engine. (Open Source Packages / Pooling System)
README
# Unity-QuickPool
[Asset store](http://u3d.as/jEu)
Usage
-----
You can use quickpool in two ways:
- Create PoolManager and configure your pools with editor

- Or create a Pool field (in this case you will need to register your pool somewhere in Start with PoolManager.RegisterPool())

Include QuickPool namespace
```C#
using QuickPool;
```
You can use extention methods
```C#
var instance = somePrefab.Spawn(Vector3.zero, Quaternion.identity);
var component = somePrefab.Spawn(Vector3.zero, Quaternion.identity);
obj.Despawn();
```
You also can get concrete pool from PoolManager or use that one you have created
```C#
public Pool pool = new Pool()
{
size = 100,
allowGrowth = true
};
// OR
var pool = PoolManager.Instance["pool name"];
```
```C#
private void Start()
{
PoolsManager.RegisterPool(pool); //register pool if you want to use extention method Despawn
pool.Initialize();
var instance = pool.Spawn(Vector3.zero, Quaternion.identity);
var conponent = pool.Spawn(Vector3.zero, Quaternion.identity);
pool.Despawn(instance);
}
```
Despawn all spawned objects
```C#
PoolsManager.DespawnAll();
// OR
pool.DespawnAll();
```