xPooling
Simplistic, code-driven and optimized solution for any scale of pooling!
Pro’s:
- Completely generic approach to the prefab re-usage (no need to create pools per prefab manually via editor);
- Zero allocations (excluding initial object instance instantiation);
- Rules of spawn (Commission) and despawn (Decommission) are defined similarly as Unity’s callbacks, but without “magic” involved;
- Interface driven, no slow broadcast messages used. Inheritance for the pooling rules are supported as a result out of the box;
- Supports poling based approach as well (e.g. for ParticleSystem / AudioSource completion via AutoPooler);
- Simplicity of code integration;
- Battle-tested in commercial and hobby projects made by me since 2017;
Cons:
-
Require an implementation of the interface in a script of the root object on the prefab for the pool to work
(Which may be an extra work, but can be bypassed by implementing and using single base class in these cases (if lazy)) -
Doesn’t have preload over frame feature out of the box
(can be implemented manually, or maybe I’ll add it someday in the future)
Source can be found here
Latest Unity package available here
License: MIT
Examples available in the package as well.
p(otential)FAQ
Q: Why just publish in the Asset Store or why it is free?
A: It requires extra work to do just to publish, as well to perform customer support which I may not have time to do. That’s why I’ve uploaded to github instead.
Q: Hurr-durr this code-driven stuff is non-sense, I want my editor out-of-the-box shinanigans!
A: This pooling is orientated towards simplicity and performance. Which means as less overhead as possible.
Q: I don’t want to write extra code!
A: Make a single base class and implement the IGenericPoolElement there. Re-use it anywhere.
Pools are sustained per-prefab, so there won’t be any issues in this case.
If you’ve got any questions, or suggestions, ask them here or at github issues page.
This is my first github upload, so if anything went wrong, please let me know.