Skip to content

Instantly share code, notes, and snippets.

@dacaes
dacaes / SimplePool.cs
Last active April 25, 2024 18:51 — forked from Draugor/SimplePool.cs
Simple pool for Unity. Change Stack to Queue to avoid reuse last used prefab (useful with active despawned GameObjects);
///
/// Simple pooling for Unity.
/// Author: Martin "quill18" Glaude (quill18@quill18.com)
/// Extended: Simon "Draugor" Wagner (https://www.twitter.com/Draugor_/)
/// Extended: Daniel Castaño Estrella (daniel.c.estrella@gmail.com)
/// Latest Version: https://gist.github.com/danielcestrella/b1b45999da9cec063f9c381e296693a8
/// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
/// UPDATES:
/// 2019-07-15 by Daniel Castaño Estrella: - Change Stack to Queue to avoid reuse last used prefab (useful with active despawned GameObjects);
/// 2019-01-24 by Daniel Castaño Estrella: - Added possibility of delayed Despawn;