unity-collection-pool

Replace temporary collection allocations with Unity's pooling primitives.

10|Updated Nov 21, 2025
One-click install
npx skills add https://github.com/creator-hian/claude-code-plugins --skill unity-collection-pool
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-collection-pool
Source: https://github.com/creator-hian/claude-code-plugins/tree/main/unity-plugin/skills/unity-collection-pool
Command: npx skills add https://github.com/creator-hian/claude-code-plugins --skill unity-collection-pool

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill teaches GC-free collection management via Unity's pooling utilities to minimize garbage collection spikes.

Core Features & Use Cases

  • ListPool, HashSetPool, DictionaryPool usage
  • CollectionPool and ObjectPool patterns
  • Pool lifecycle, disposal, and safe usage
  • Real-world pooling patterns for frequent allocations

Quick Start

Use ListPool to obtain a temporary list, fill it, and release back to the pool.

Frequently Asked Questions about unity-collection-pool

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I eliminate garbage collection spikes from temporary collections in Unity?

Use Unity's built-in pooling primitives—ListPool, DictionaryPool, and HashSetPool—to reuse collection instances instead of allocating new ones. Obtain a collection via Get(), use it, then Release() it back to the pool to avoid GC allocations in high-frequency scenarios like per-frame processing.

What's the best way to handle temporary lists in Unity without creating garbage?

ListPool provides GC-free temporary list management through Get/Release patterns. Retrieve a list, populate it for your operation, and return it to the pool immediately. The pool clears the list automatically on retrieval, enabling safe reuse across frames.

Can I use pooling for dictionaries and hash sets in Unity the same way as lists?

Yes. DictionaryPool and HashSetPool follow identical Get/Release patterns as ListPool. All three integrate with Unity's using statement for automatic release, making them interchangeable pooling solutions for different collection types.

When should I apply collection pooling in my Unity game or editor tool?

Apply pooling to high-frequency, short-lived collection scenarios: temporary lookups, duplicate checks, per-frame batching, and processing temporary lists. Pooling eliminates GC pressure when operations repeat every frame or in tight loops across gameplay sessions.

Does ObjectPool work with the same pooling patterns as ListPool and DictionaryPool?

ObjectPool follows similar lifecycle principles but is generic and applies to custom object types, not built-in collections. It shares the Get/Release pattern and pool lifecycle discipline but requires manual Clear() logic and type-safe instantiation for non-collection objects.