---
title: "Object Pools - s&box library"
description: "Just a regular list based object pool."
canonical: "https://sbox.watch/zh-cn/libraries/hotpot/objectpools/"
generated_at: "2026-11-27T13:00:25.244Z"
---

# Object Pools

Just a regular list based object pool.

- 类型: 库
- 标识符: hotpot.objectpools
- 创作者: hotdawg
- 规范地址: https://sbox.watch/zh-cn/libraries/hotpot/objectpools/
- Markdown: https://sbox.watch/zh-cn/libraries/hotpot/objectpools/index.md
- sbox.game: https://sbox.game/hotpot/objectpools/
- 生成时间: 2026-11-27T13:00:25.244Z

## 统计

- 24小时热度: +0
- Terry 评分: --
- 收藏: 0
- 好评: 0
- 差评: 0
- 更新时间: 2025年6月11日
- 创建时间: 2025年6月11日
- 大小: 3.7 KB
- 文件: 2
- 标签: object, pool, pooling

## 描述

Example
using ObjectPools;

public sealed class TestObjectPool : Component
{
 \[Property\] private GameObject prefab { get; set; }

 private ObjectPool<GameObject> \_pool;

 protected override void OnStart()
 {
 \_pool = new ObjectPool<GameObject>(
 OnCreate,
 OnGet,
 OnRelease,
 OnDestroy,
 defaultCapacity: 10,
 maxAmount: 10000,
 collectionCheck: true);
 }

 GameObject OnCreate()
 {
 return prefab.Clone();
 }

 void OnGet(GameObject obj)
 {
 obj.Enabled = true;
 }

 void OnRelease(GameObject obj)
 {
 obj.Enabled = false;
 }

 void OnDestroy(GameObject obj)
 {
 obj.Destroy();
 }
}



## More by hotdawg

| Package | 标识符 | 玩家 | 收藏 | 好评 | 评分 | Markdown |
| --- | --- | --- | --- | --- | --- | --- |
| Chit Chat Dialogue System | hotpot.chitchat | 0 | 5 | 4 | 60% | https://sbox.watch/zh-cn/libraries/hotpot/chitchat/index.md |
