com.amanotes.prefabpool 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -7
- package/README.md +2 -2
- package/Runtime/PrefabPool.cs +12 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.1.0] - 2026-04-21
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `IPrefabPool.MarkShutdown()` — marks pool as shut down so Get/Return calls no-op safely
|
|
7
|
+
- `PrefabPool.MarkShutdown()` implementation — sets `_isDestroyed = true`
|
|
8
|
+
|
|
9
|
+
## [1.0.3] - 2026-04-07
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `PoolEntry.Return` renames pooled GameObjects back to entry `id` in Editor
|
|
13
|
+
|
|
3
14
|
## [1.0.2] - 2026-04-06
|
|
4
15
|
|
|
5
16
|
### Fixed
|
|
6
|
-
- `PoolEntry.Return
|
|
7
|
-
- `PoolEntry.Get
|
|
8
|
-
- `PoolEntry.PreAllocate
|
|
9
|
-
- `PrefabPool.DestroyPool
|
|
10
|
-
- `PrefabPool.Initialize
|
|
11
|
-
- `PoolEntry.PurgeDestroyed
|
|
12
|
-
- `PrefabPool.PurgeStaleInstanceMap
|
|
17
|
+
- `PoolEntry.Return` deactivates before `SetParent` to prevent parent activation error
|
|
18
|
+
- `PoolEntry.Get` explicit `SetActive(true)` for consistent pool state
|
|
19
|
+
- `PoolEntry.PreAllocate` prewarm objects spawned inactive
|
|
20
|
+
- `PrefabPool.DestroyPool` properly destroys `_customPool` entries
|
|
21
|
+
- `PrefabPool.Initialize` added `_isInitializing` guard against double-prewarm
|
|
22
|
+
- `PoolEntry.PurgeDestroyed` removes stale refs on `Register`
|
|
23
|
+
- `PrefabPool.PurgeStaleInstanceMap` cleans up externally-destroyed objects (Editor only)
|
|
13
24
|
|
|
14
25
|
## [1.0.1]
|
|
15
26
|
|
|
27
|
+
### Added
|
|
16
28
|
- Initial release
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# PrefabPool
|
|
2
2
|
|
|
3
3
|
**Package:** `com.amanotes.prefabpool`
|
|
4
|
-
**Version:** 1.0.
|
|
4
|
+
**Version:** 1.0.3
|
|
5
5
|
|
|
6
6
|
Generic object pooling system for Unity with lifecycle callbacks and material pooling support.
|
|
7
7
|
|
|
@@ -30,7 +30,7 @@ Add the package to your Unity project via `Packages/manifest.json`:
|
|
|
30
30
|
```json
|
|
31
31
|
{
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"com.amanotes.prefabpool": "1.0.
|
|
33
|
+
"com.amanotes.prefabpool": "1.0.3"
|
|
34
34
|
},
|
|
35
35
|
"scopedRegistries": [
|
|
36
36
|
{
|
package/Runtime/PrefabPool.cs
CHANGED
|
@@ -41,6 +41,7 @@ namespace Amanotes.Core
|
|
|
41
41
|
_pool.RemoveAt(lastIndex);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
bool fromPool = resultGameObject != null;
|
|
44
45
|
if (resultGameObject == null)
|
|
45
46
|
{
|
|
46
47
|
// Create prefab inside the pool's transform
|
|
@@ -77,6 +78,9 @@ namespace Amanotes.Core
|
|
|
77
78
|
gameObject.SetActive(false);
|
|
78
79
|
t.SetParent(poolParent, false);
|
|
79
80
|
t.localPosition = Vector3.zero;
|
|
81
|
+
#if UNITY_EDITOR
|
|
82
|
+
gameObject.name = id;
|
|
83
|
+
#endif
|
|
80
84
|
_pool.Add(gameObject);
|
|
81
85
|
}
|
|
82
86
|
|
|
@@ -164,6 +168,12 @@ namespace Amanotes.Core
|
|
|
164
168
|
GameObject Get(PoolGroup group, string prefabId, Vector3 localPosition = default, Transform customParent = null);
|
|
165
169
|
void Return(PoolGroup group, GameObject gameObject);
|
|
166
170
|
IEnumerator Initialize();
|
|
171
|
+
/// <summary>
|
|
172
|
+
/// Marks the pool as shut down so all subsequent Get/Return calls no-op safely.
|
|
173
|
+
/// Call this before detaching tiles during game shutdown to prevent SetParent errors
|
|
174
|
+
/// when the pool's hierarchy is being deactivated.
|
|
175
|
+
/// </summary>
|
|
176
|
+
void MarkShutdown();
|
|
167
177
|
}
|
|
168
178
|
|
|
169
179
|
public static class PrefabPoolExtensions
|
|
@@ -304,6 +314,8 @@ namespace Amanotes.Core
|
|
|
304
314
|
|
|
305
315
|
public bool IsReady => _isReady;
|
|
306
316
|
|
|
317
|
+
public void MarkShutdown() => _isDestroyed = true;
|
|
318
|
+
|
|
307
319
|
public void RegisterGroup(PoolGroup group, Transform spawnParent)
|
|
308
320
|
{
|
|
309
321
|
if (group == null) return;
|
package/package.json
CHANGED