Skip to content

Commit 54b2597

Browse files
committed
2 parents de10bcf + ecab7b8 commit 54b2597

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Description
2-
A basic pool implementation that lets you easily register any Monobehavior as a Unity objectPool.
2+
A pool implementation that lets you easily register any Monobehavior as a Unity objectPool.
3+
The pool is customizable and has built-in functions such as defining a retrieve/release strategy, defining a prewarming budget, spawning under a specific transform
34

45
## Installation
56
Add to your manifest.json the following
@@ -15,5 +16,22 @@ using Vcontainer.ObjectPool;
1516
[SerializeField] private StorageSlotView storageSlotView;
1617
1718
...
18-
builder.RegisterViewPoolFactory(storageSlotView, new ViewPoolConfig(5,"StorageSlotViewPool"), Lifetime.Singleton);
19+
// Helper method that uses a default strategy, toggling the object active state and parenting to a give transform
20+
builder.RegisterUISlotsPool(storageSlotView, 25);
21+
22+
// Helper method that uses a default strategy, keeping it always active and just moving it out of bounds
23+
builder.RegisterWorldEntityPool(storageSlotView, 50);
24+
25+
// Or you could manually define yours
26+
var poolName = "mypool";
27+
var config = new ViewPoolConfig(
28+
initialSize: 10,
29+
viewPoolTransformName: poolName,
30+
releaseStrategy: DisableObject | ReparentToPool,
31+
retrieveeStrategy: PoolRetrieveStrategy.ActivateObject | PoolRetrieveStrategy.MoveToCoords,
32+
prewarmBudgetMs: 10f,
33+
outOfBoundsOffset: new Vector3(10f, 10f, 10f)
34+
);
35+
36+
builder.RegisterViewPoolFactory(prefab, config, lifetime);
1937
```

0 commit comments

Comments
 (0)