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 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`: deactivate GameObject before `SetParent` to prevent `Cannot set the parent of the GameObject while activating or deactivating the parent GameObject` error during scene shutdown
7
- - `PoolEntry.Get`: explicit `SetActive(true)` to match — objects are now consistently inactive in pool, active when in use
8
- - `PoolEntry.PreAllocate`: prewarm objects are now spawned inactive, consistent with the return state
9
- - `PrefabPool.DestroyPool`: `_customPool` (Resize<T>) entries are now properly destroyed on shutdown
10
- - `PrefabPool.Initialize`: added `_isInitializing` guard to prevent double-prewarm if called concurrently
11
- - `PoolEntry.PurgeDestroyed`: new method, called on `Register` to remove stale destroyed-object refs when a PoolGroup ScriptableObject is reused across scene loads
12
- - `PrefabPool.PurgeStaleInstanceMap`: cleans up `_instanceTypeMap` entries for externally-destroyed objects (Editor only)
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.1
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.1"
33
+ "com.amanotes.prefabpool": "1.0.3"
34
34
  },
35
35
  "scopedRegistries": [
36
36
  {
@@ -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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "com.amanotes.prefabpool",
3
- "version": "1.0.2",
4
- "displayName": "Amanotes Prefab Pool",
3
+ "version": "1.1.0",
4
+ "displayName": "[Ama] Prefab Pool",
5
5
  "description": "Generic object pooling system for Unity",
6
6
  "unity": "2022.3",
7
7
  "keywords": [