This pool creates objects that you defined on start and creates additionally if more spawn request comes to the pool than pools capacity and manages newly added pool objects too ! .
- Zenject IOC (Find HERE )
- Go to release page.
- Download the lates release of the package.
- Import it to your unity project.
- Add ObjectPooler component to an object
- Set a size for the pool.
- Create prefabs to pool
- Edit PooledObjectType.cs class according to your prefabs which you want to pool
- Go to the scene object with ObjectPooler component and assign prefabs and enums and set size for each pooled object.
- Ready to go !
(This part assumes you've set-up your zenject installer and contexts)
[Inject]
private ObjectPooler _pooler;
_pooler.SpawnFromPool(PooledObjectType.YourTypeComesHere , YourVector3PositionComesHere, YourQuaternionRotationComesHere,Optional_YourParentTransformComesHere,Optional_PooledObjectInitializationArgsComesHere);
_pooler.Despawn(gameObject);
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
- Zenject - used for dependency injection
I would like to extend a special thank you to the creators and maintainers of Zenject for their excellent work on this dependency injection framework. Their contributions have greatly improved the functionality and usability of this project.