Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Woreira/Unity-Simple-Pooling-System
A simple, easy to implement pooling system for unity
https://github.com/Woreira/Unity-Simple-Pooling-System
csharp pooling unity unity3d utility
Last synced: about 19 hours ago
JSON representation
A simple, easy to implement pooling system for unity
- Host: GitHub
- URL: https://github.com/Woreira/Unity-Simple-Pooling-System
- Owner: Woreira
- License: mit
- Created: 2022-02-09T15:03:07.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-09T15:38:44.000Z (almost 3 years ago)
- Last Synced: 2024-08-02T05:13:24.144Z (3 months ago)
- Topics: csharp, pooling, unity, unity3d, utility
- Language: C#
- Homepage:
- Size: 46.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Unity Simple Pooling System
An easy to implement pooling system. Meant for those *"in hindsight I should have used that"* moments. It uses dictionaries to keep track of the pools and the objects.This was made as a "one size fits all approach" needless to say, it is faster than Instantiate-then-Destroy, but not as fast as a custom system.
> The main purpose here is a system that works with minimal changes to
> the rest of the code, `Instantiate()` calls can be swapped easily by
> `PoolManager.Allocate()`, and the same goes for `Destroy()` and
> `PoolManager.Deallocate()`## Usage
- **Allocate** from the pool using `PoolManager.Allocate()`, in place of instantiate, no need for those pesky pool managing things or convoluted calls:
- ![Allocation Example](https://github.com/Woreira/Unity-Pooling-System/blob/main/Snippets/Captura%20de%20tela%202022-02-09%20121514.png)
- **Deallocate** from the pool using `PoolManager.Deallocate()`:
- ![Deallocation Example](https://github.com/Woreira/Unity-Pooling-System/blob/main/Snippets/Captura%20de%20tela%202022-02-09%20121614.png)
- Use `PoolManager.ClearAllPools()` to clear all pools *(duh)*, it calls `PoolManager.Deallocate(`) on every pooled obj. This prevents bugs especially on scene changes and level wipes (like having to wipe all enemies from the scene on gameover, for example);Liked the repo? Give it a star then!