com.amanotes.prefabpool 1.3.0 → 2.0.2

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,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.2] - 2026-09-14
4
+
5
+ ### Fixed
6
+ - Pool-group registration during prewarm updates the registration without invalidating the initialization traversal.
7
+
8
+ ### Removed
9
+ - Runtime tests from the distributable UPM package; tests remain in the development project.
10
+
11
+ ## [2.0.1] - 2026-08-15
12
+
13
+ ### Fixed
14
+ - `PrefabPool.DestroyPool` now destroys checked-out instances (not only inactive `_pool` lists). Previously live clones with `HideFlags.DontSave` and a null spawn parent survived scene unload on device because `_instanceTypeMap` was only resolved in the Editor.
15
+ - `PrefabPool.OnDestroy` calls `DestroyPool` so scene teardown always wipes every clone the pool instantiated.
16
+
17
+ ## [2.0.0] - 2026-07-22
18
+
19
+ ### Added
20
+ - `UnityObjectId` / `UnityObjectIdentity` — cross-version object identity using `EntityId` on Unity 6.0.4+ and `GetInstanceID()` on earlier versions (`UnityObjectIdentity.cs`)
21
+
22
+ ### Changed
23
+ - **Breaking:** `MaterialPool.Take(Material, int borrowId)` → `MaterialPool.Take(Material, UnityObject borrower)` (`MaterialPool.cs`)
24
+ - **Breaking:** `MaterialPool.Return(int borrowId)` → `MaterialPool.Return(UnityObject borrower)` (`MaterialPool.cs`)
25
+ - Internal pool dictionaries use `UnityObjectId` keys instead of `int` instance IDs (`MaterialPool.cs`, `PrefabPool.cs`)
26
+
3
27
  ## [1.3.0] - 2026-06-12
4
28
 
5
29
  ### Added
@@ -1,6 +1,6 @@
1
1
  # PrefabPool API Reference
2
2
 
3
- **Package:** `com.amanotes.prefabpool` | **Version:** 1.2.0 | **Namespace:** `Amanotes.Core`
3
+ **Package:** `com.amanotes.prefabpool` | **Version:** 2.0.2 | **Namespace:** `Amanotes.Core`
4
4
 
5
5
  Generic object pooling system to eliminate garbage collection spikes from frequent instantiation/destruction.
6
6
 
@@ -22,6 +22,8 @@ public interface IPrefabPool
22
22
  GameObject Get(PoolGroup group, string prefabId, Vector3 localPosition = default, Transform customParent = null);
23
23
  void Return(PoolGroup group, GameObject gameObject);
24
24
  IEnumerator Initialize(); // Pre-allocate pooled objects
25
+ void MarkShutdown();
26
+ void DestroyPool(); // Inactive + checked-out clones
25
27
  }
26
28
  ```
27
29
 
@@ -175,22 +177,24 @@ Static utility for pooling material instances.
175
177
  ```csharp
176
178
  public static class MaterialPool
177
179
  {
178
- public static Material Take(Material sourceOrClone, int borrowId);
179
- public static void Return(int borrowId);
180
+ public static Material Take(Material sourceOrClone, UnityObject borrower);
181
+ public static void Return(UnityObject borrower);
180
182
  }
181
183
  ```
182
184
 
183
185
  **Example:**
184
186
  ```csharp
187
+ using UnityEngine;
188
+
185
189
  // Borrow material
186
- Material mat = MaterialPool.Take(originalMaterial, GetInstanceID());
187
- renderer.material = mat;
190
+ Material mat = MaterialPool.Take(originalMaterial, renderer);
191
+ renderer.sharedMaterial = mat;
188
192
  mat.SetAlpha(0.5f);
189
193
 
190
194
  // Return on destroy
191
195
  void OnDestroy()
192
196
  {
193
- MaterialPool.Return(GetInstanceID());
197
+ MaterialPool.Return(renderer);
194
198
  }
195
199
  ```
196
200
 
@@ -313,17 +317,19 @@ void UpdateTileCount(int count)
313
317
  ### Pattern 4: Material Pooling
314
318
 
315
319
  ```csharp
320
+ using UnityEngine;
321
+
316
322
  // When to use: Dynamic color/alpha changes without creating material instances
317
323
  public class ColoredTile : MonoBehaviour
318
324
  {
319
325
  private Material instanceMaterial;
320
- private int borrowId;
326
+ private Renderer _renderer;
321
327
 
322
328
  void Start()
323
329
  {
324
- borrowId = GetInstanceID();
325
- instanceMaterial = MaterialPool.Take(GetComponent<Renderer>().sharedMaterial, borrowId);
326
- GetComponent<Renderer>().material = instanceMaterial;
330
+ _renderer = GetComponent<Renderer>();
331
+ instanceMaterial = MaterialPool.Take(_renderer.sharedMaterial, _renderer);
332
+ _renderer.sharedMaterial = instanceMaterial;
327
333
  }
328
334
 
329
335
  public void SetColor(Color color)
@@ -333,7 +339,7 @@ public class ColoredTile : MonoBehaviour
333
339
 
334
340
  void OnDestroy()
335
341
  {
336
- MaterialPool.Return(borrowId);
342
+ MaterialPool.Return(_renderer);
337
343
  }
338
344
  }
339
345
  ```
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # PrefabPool
2
2
 
3
3
  **Package:** `com.amanotes.prefabpool`
4
- **Version:** 1.3.0
4
+ **Version:** 2.0.2
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.3.0"
33
+ "com.amanotes.prefabpool": "2.0.2"
34
34
  },
35
35
  "scopedRegistries": [
36
36
  {
@@ -23,28 +23,29 @@ namespace Amanotes.Core
23
23
 
24
24
  public partial class MaterialPool
25
25
  {
26
- [NonSerialized] private static readonly Dictionary<int, MaterialPool> _map = new Dictionary<int, MaterialPool>();
27
- [NonSerialized] private static readonly Dictionary<int, MaterialPool> _cloned = new Dictionary<int, MaterialPool>();
26
+ [NonSerialized] private static readonly Dictionary<UnityObjectId, MaterialPool> _map = new Dictionary<UnityObjectId, MaterialPool>();
27
+ [NonSerialized] private static readonly Dictionary<UnityObjectId, MaterialPool> _cloned = new Dictionary<UnityObjectId, MaterialPool>();
28
28
 
29
29
  private static MaterialPool GetPool(Material sourceOrClone)
30
30
  {
31
31
  if (sourceOrClone == null) return null;
32
- var instId = sourceOrClone.GetInstanceID();
32
+ var instId = UnityObjectIdentity.GetId(sourceOrClone);
33
33
  var isCloned = sourceOrClone.hideFlags == HideFlags.DontSave;
34
34
  return isCloned
35
35
  ? _cloned.GetValueOrDefault(instId)
36
36
  : _map.GetValueOrDefault(instId);
37
37
  }
38
38
 
39
- public static Material Take(Material sourceOrClone, int borrowId)
39
+ public static Material Take(Material sourceOrClone, UnityObject borrower)
40
40
  {
41
41
  if (sourceOrClone == null) return null;
42
42
  var pool = GetPool(sourceOrClone) ?? new MaterialPool(sourceOrClone);
43
- return pool.InternalTake(borrowId);
43
+ return pool.InternalTake(UnityObjectIdentity.GetId(borrower));
44
44
  }
45
45
 
46
- public static void Return(int borrowId)
46
+ public static void Return(UnityObject borrower)
47
47
  {
48
+ var borrowId = UnityObjectIdentity.GetId(borrower);
48
49
  foreach (var kvp in _map)
49
50
  {
50
51
  kvp.Value.InternalReturn(borrowId);
@@ -56,12 +57,12 @@ namespace Amanotes.Core
56
57
  {
57
58
  private readonly Material original;
58
59
  private readonly List<Material> pool = new List<Material>();
59
- private readonly Dictionary<int, Material> borrowed = new Dictionary<int, Material>();
60
+ private readonly Dictionary<UnityObjectId, Material> borrowed = new Dictionary<UnityObjectId, Material>();
60
61
 
61
62
  private MaterialPool(Material source)
62
63
  {
63
64
  original = source;
64
- _map[original.GetInstanceID()] = this;
65
+ _map[UnityObjectIdentity.GetId(original)] = this;
65
66
 
66
67
  if (source.hideFlags == HideFlags.DontSave)
67
68
  {
@@ -78,7 +79,7 @@ namespace Amanotes.Core
78
79
  if (pool.Count <= 0)
79
80
  {
80
81
  result = new Material(original) { hideFlags = HideFlags.DontSave };
81
- _cloned[result.GetInstanceID()] = this;
82
+ _cloned[UnityObjectIdentity.GetId(result)] = this;
82
83
  return result;
83
84
  }
84
85
 
@@ -87,7 +88,7 @@ namespace Amanotes.Core
87
88
  return result;
88
89
  }
89
90
 
90
- private Material InternalTake(int borrowId)
91
+ private Material InternalTake(UnityObjectId borrowId)
91
92
  {
92
93
  if (borrowed.TryGetValue(borrowId, out var mat)) return mat;
93
94
 
@@ -97,7 +98,7 @@ namespace Amanotes.Core
97
98
  return material;
98
99
  }
99
100
 
100
- private void InternalReturn(int borrowId)
101
+ private void InternalReturn(UnityObjectId borrowId)
101
102
  {
102
103
  if (borrowed.Remove(borrowId, out var mat)) pool.Add(mat);
103
104
  }
@@ -23,14 +23,14 @@ namespace Amanotes.Core
23
23
  [NonSerialized] private PoolGroup _parentGroup;
24
24
 
25
25
  // Per-instance IPoolPrefab cache — components don't change on pooled prefabs
26
- [NonSerialized] private readonly Dictionary<int, IPoolPrefab[]> _poolPrefabCache = new Dictionary<int, IPoolPrefab[]>(32);
26
+ [NonSerialized] private readonly Dictionary<UnityObjectId, IPoolPrefab[]> _poolPrefabCache = new Dictionary<UnityObjectId, IPoolPrefab[]>(32);
27
27
  [NonSerialized] private static readonly List<IPoolPrefab> _tempPoolPrefabs = new List<IPoolPrefab>(8);
28
28
 
29
29
  public void SetParentGroup(PoolGroup parentGroup) => _parentGroup = parentGroup;
30
30
 
31
31
  private IPoolPrefab[] GetCachedPoolPrefabs(GameObject go)
32
32
  {
33
- var instanceId = go.GetInstanceID();
33
+ var instanceId = UnityObjectIdentity.GetId(go);
34
34
  if (_poolPrefabCache.TryGetValue(instanceId, out var cached)) return cached;
35
35
 
36
36
  go.GetComponents(_tempPoolPrefabs);
@@ -214,6 +214,10 @@ namespace Amanotes.Core
214
214
  /// when the pool's hierarchy is being deactivated.
215
215
  /// </summary>
216
216
  void MarkShutdown();
217
+ /// <summary>
218
+ /// Destroys every clone this pool instantiated (inactive lists and checked-out live instances).
219
+ /// </summary>
220
+ void DestroyPool();
217
221
  }
218
222
 
219
223
  public static class PrefabPoolExtensions
@@ -311,7 +315,10 @@ namespace Amanotes.Core
311
315
  [NonSerialized] private bool _isReady = false;
312
316
  [NonSerialized] private bool _isInitializing = false;
313
317
  [NonSerialized] private readonly Dictionary<string, PoolGroup> _groups = new Dictionary<string, PoolGroup>();
314
- [NonSerialized] private readonly Dictionary<int, PoolEntry> _instanceTypeMap = new Dictionary<int, PoolEntry>();
318
+ // Registration order for Initialize — only appended on first RegisterGroup per id.
319
+ [NonSerialized] private readonly List<PoolGroup> _groupOrder = new List<PoolGroup>();
320
+ [NonSerialized] private readonly Dictionary<UnityObjectId, PoolEntry> _instanceTypeMap = new Dictionary<UnityObjectId, PoolEntry>();
321
+ [NonSerialized] private readonly Dictionary<UnityObjectId, GameObject> _liveInstances = new Dictionary<UnityObjectId, GameObject>();
315
322
  [NonSerialized] private readonly Dictionary<GameObject, PoolEntry> _customPool = new Dictionary<GameObject, PoolEntry>();
316
323
 
317
324
  public void Resize<T>(GameObject prefab, List<T> list, int count, Transform parent) where T: Component
@@ -359,8 +366,24 @@ namespace Amanotes.Core
359
366
  public void RegisterGroup(PoolGroup group, Transform spawnParent)
360
367
  {
361
368
  if (group == null) return;
362
-
369
+
370
+ if (_groups.TryGetValue(group.id, out var existing))
371
+ {
372
+ // AttachHost re-registers tile/vfx groups from Start while Initialize is yielding.
373
+ // Updating spawn parent must not touch _groups — that invalidates Dictionary enumeration.
374
+ group.Register(this, spawnParent);
375
+ if (!ReferenceEquals(existing, group))
376
+ {
377
+ _groups[group.id] = group;
378
+ var index = _groupOrder.IndexOf(existing);
379
+ if (index >= 0) _groupOrder[index] = group;
380
+ }
381
+ PurgeStaleInstanceMap();
382
+ return;
383
+ }
384
+
363
385
  _groups[group.id] = group;
386
+ _groupOrder.Add(group);
364
387
  group.Register(this, spawnParent);
365
388
  PurgeStaleInstanceMap();
366
389
  }
@@ -385,7 +408,9 @@ namespace Amanotes.Core
385
408
  var result = entry.Get(transform, p, localPosition);
386
409
  if (result != null)
387
410
  {
388
- _instanceTypeMap[result.GetInstanceID()] = entry;
411
+ var id = UnityObjectIdentity.GetId(result);
412
+ _instanceTypeMap[id] = entry;
413
+ _liveInstances[id] = result;
389
414
  }
390
415
 
391
416
  return result;
@@ -395,11 +420,12 @@ namespace Amanotes.Core
395
420
  {
396
421
  if (_isDestroyed || group == null || go == null) return;
397
422
 
398
- var instanceId = go.GetInstanceID();
423
+ var instanceId = UnityObjectIdentity.GetId(go);
399
424
  if (_instanceTypeMap.TryGetValue(instanceId, out var entry))
400
425
  {
401
426
  entry.Return(go, transform);
402
427
  _instanceTypeMap.Remove(instanceId);
428
+ _liveInstances.Remove(instanceId);
403
429
  }
404
430
  }
405
431
 
@@ -407,12 +433,16 @@ namespace Amanotes.Core
407
433
  {
408
434
  #if UNITY_EDITOR
409
435
  if (_instanceTypeMap.Count == 0) return;
410
- var stale = new List<int>();
436
+ var stale = new List<UnityObjectId>();
411
437
  foreach (var kvp in _instanceTypeMap)
412
438
  {
413
- if (EditorUtility.InstanceIDToObject(kvp.Key) == null) stale.Add(kvp.Key);
439
+ if (UnityObjectIdentity.IdToObject(kvp.Key) == null) stale.Add(kvp.Key);
440
+ }
441
+ foreach (var id in stale)
442
+ {
443
+ _instanceTypeMap.Remove(id);
444
+ _liveInstances.Remove(id);
414
445
  }
415
- foreach (var id in stale) _instanceTypeMap.Remove(id);
416
446
  #endif
417
447
  }
418
448
 
@@ -425,26 +455,29 @@ namespace Amanotes.Core
425
455
  EditorApplication.playModeStateChanged -= HandlePlayModeChanged;
426
456
  EditorApplication.playModeStateChanged += HandlePlayModeChanged;
427
457
  #endif
428
-
429
- foreach (var group in _groups.Values)
430
- {
431
- foreach (var entry in group.entries)
432
- {
433
- if (entry.prefab == null) continue;
434
- yield return entry.PreAllocate(transform);
435
- }
436
-
437
- // Pre-allocate fallback entry if available
438
- if (group.fallbackEntry != null && group.fallbackEntry.prefab != null)
439
- {
440
- yield return group.fallbackEntry.PreAllocate(transform);
441
- }
442
- }
458
+
459
+ // Drain _groupOrder by index so groups appended during PreAllocate yields still prewarm.
460
+ for (var i = 0; i < _groupOrder.Count; i++)
461
+ yield return PrewarmGroup(_groupOrder[i]);
443
462
 
444
463
  _isInitializing = false;
445
464
  _isReady = true;
446
465
  }
447
466
 
467
+ IEnumerator PrewarmGroup(PoolGroup group)
468
+ {
469
+ if (group == null) yield break;
470
+
471
+ foreach (var entry in group.entries)
472
+ {
473
+ if (entry.prefab == null) continue;
474
+ yield return entry.PreAllocate(transform);
475
+ }
476
+
477
+ if (group.fallbackEntry != null && group.fallbackEntry.prefab != null)
478
+ yield return group.fallbackEntry.PreAllocate(transform);
479
+ }
480
+
448
481
  #if UNITY_EDITOR
449
482
  protected void HandlePlayModeChanged(PlayModeStateChange changed)
450
483
  {
@@ -454,39 +487,54 @@ namespace Amanotes.Core
454
487
  }
455
488
  }
456
489
  #endif
490
+
491
+ void OnDestroy()
492
+ {
493
+ #if UNITY_EDITOR
494
+ EditorApplication.playModeStateChanged -= HandlePlayModeChanged;
495
+ #endif
496
+ DestroyPool();
497
+ }
457
498
 
458
499
  public void DestroyPool()
459
500
  {
460
501
  _isDestroyed = true;
502
+
503
+ foreach (var go in _liveInstances.Values)
504
+ DestroyClone(go);
505
+ _liveInstances.Clear();
506
+ _instanceTypeMap.Clear();
461
507
 
462
- foreach (var group in _groups.Values)
508
+ foreach (var group in _groupOrder)
463
509
  {
464
510
  foreach (var entry in group.entries)
465
- {
466
511
  entry.DestroyPool();
467
- }
468
-
512
+
469
513
  if (group.fallbackEntry != null)
470
- {
471
514
  group.fallbackEntry.DestroyPool();
472
- }
473
515
  }
474
516
  _groups.Clear();
517
+ _groupOrder.Clear();
475
518
 
476
519
  foreach (var entry in _customPool.Values)
477
520
  {
478
521
  entry.DestroyPool();
479
522
  }
480
523
  _customPool.Clear();
481
-
524
+ }
525
+
526
+ static void DestroyClone(GameObject go)
527
+ {
528
+ if (go == null) return;
482
529
  #if UNITY_EDITOR
483
- foreach (var kvp in _instanceTypeMap)
530
+ if (!Application.isPlaying)
484
531
  {
485
- var obj = EditorUtility.InstanceIDToObject(kvp.Key);
486
- if (obj != null) UnityObject.DestroyImmediate(obj);
532
+ UnityObject.DestroyImmediate(go);
533
+ return;
487
534
  }
488
535
  #endif
489
- _instanceTypeMap.Clear();
536
+ UnityObject.Destroy(go);
490
537
  }
491
538
  }
492
- }
539
+ }
540
+
@@ -0,0 +1,60 @@
1
+ using System;
2
+ using UnityEngine;
3
+ using UnityObject = UnityEngine.Object;
4
+
5
+ namespace Amanotes.Core
6
+ {
7
+ internal readonly struct UnityObjectId : IEquatable<UnityObjectId>
8
+ {
9
+ #if UNITY_6000_4_OR_NEWER
10
+ private readonly EntityId _id;
11
+
12
+ public UnityObjectId(UnityObject obj) => _id = obj != null ? obj.GetEntityId() : default;
13
+
14
+ public bool IsValid => _id.IsValid();
15
+
16
+ public bool Equals(UnityObjectId other) => _id.Equals(other._id);
17
+
18
+ public override int GetHashCode() => _id.GetHashCode();
19
+
20
+ public override string ToString() => _id.ToString();
21
+
22
+ #if UNITY_EDITOR
23
+ public UnityObject ToObject() => UnityEditor.EditorUtility.EntityIdToObject(_id);
24
+ #endif
25
+ #else
26
+ private readonly int _id;
27
+
28
+ public UnityObjectId(UnityObject obj) => _id = obj != null ? obj.GetInstanceID() : 0;
29
+
30
+ public bool IsValid => _id != 0;
31
+
32
+ public bool Equals(UnityObjectId other) => _id == other._id;
33
+
34
+ public override int GetHashCode() => _id;
35
+
36
+ public override string ToString() => _id.ToString();
37
+
38
+ #if UNITY_EDITOR
39
+ public UnityObject ToObject() => UnityEditor.EditorUtility.InstanceIDToObject(_id);
40
+ #endif
41
+ #endif
42
+
43
+ public static bool operator ==(UnityObjectId left, UnityObjectId right) => left.Equals(right);
44
+
45
+ public static bool operator !=(UnityObjectId left, UnityObjectId right) => !left.Equals(right);
46
+
47
+ public override bool Equals(object obj) => obj is UnityObjectId other && Equals(other);
48
+ }
49
+
50
+ internal static class UnityObjectIdentity
51
+ {
52
+ public static UnityObjectId GetId(UnityObject obj) => new UnityObjectId(obj);
53
+
54
+ public static bool IsValid(UnityObjectId id) => id.IsValid;
55
+
56
+ #if UNITY_EDITOR
57
+ public static UnityObject IdToObject(UnityObjectId id) => id.ToObject();
58
+ #endif
59
+ }
60
+ }
@@ -1,5 +1,5 @@
1
1
  fileFormatVersion: 2
2
- guid: 9c6969a47577843fb977ab5e2c7c1ad2
2
+ guid: 082b2708eccfb47e1b78c452d24ec500
3
3
  MonoImporter:
4
4
  externalObjects: {}
5
5
  serializedVersion: 2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.prefabpool",
3
- "version": "1.3.0",
3
+ "version": "2.0.2",
4
4
  "displayName": "[Ama] Prefab Pool",
5
5
  "description": "Generic object pooling system for Unity",
6
6
  "unity": "2022.3",
@@ -1,11 +0,0 @@
1
- {
2
- "name": "PrefabPool.Tests",
3
- "rootNamespace": "Amanotes.Core",
4
- "references": [
5
- "PrefabPool",
6
- "Unity.PerformanceTesting"
7
- ],
8
- "optionalUnityReferences": [
9
- "TestAssemblies"
10
- ]
11
- }
@@ -1,7 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: f4f4c6bd22a404f98bd5cc47335df5d8
3
- AssemblyDefinitionImporter:
4
- externalObjects: {}
5
- userData:
6
- assetBundleName:
7
- assetBundleVariant:
@@ -1,224 +0,0 @@
1
- using System.Collections;
2
- using System.Collections.Generic;
3
- using NUnit.Framework;
4
- using UnityEngine;
5
- using UnityEngine.TestTools;
6
- using UnityObject = UnityEngine.Object;
7
-
8
- namespace Amanotes.Core
9
- {
10
- public class PrefabPoolGroupTests
11
- {
12
- private PrefabPool _pool;
13
- private PoolGroup _groupA;
14
- private PoolGroup _groupB;
15
- private GameObject _prefabA;
16
- private GameObject _prefabB;
17
- private Transform _spawnParentA;
18
- private Transform _spawnParentB;
19
-
20
- [SetUp]
21
- public void SetUp()
22
- {
23
- var poolObject = new GameObject("TestPool");
24
- _pool = poolObject.AddComponent<PrefabPool>();
25
-
26
- var spawnParentObjectA = new GameObject("SpawnParentA");
27
- _spawnParentA = spawnParentObjectA.transform;
28
-
29
- var spawnParentObjectB = new GameObject("SpawnParentB");
30
- _spawnParentB = spawnParentObjectB.transform;
31
-
32
- _prefabA = new GameObject("PrefabA");
33
- _prefabA.AddComponent<MockPoolPrefab>();
34
-
35
- _prefabB = new GameObject("PrefabB");
36
- _prefabB.AddComponent<MockPoolPrefab>();
37
-
38
- _groupA = new PoolGroup
39
- {
40
- id = "GroupA",
41
- entries = new List<PoolEntry>
42
- {
43
- new PoolEntry
44
- {
45
- id = "PrefabA",
46
- prefab = _prefabA,
47
- prewarmCount = 5
48
- }
49
- }
50
- };
51
-
52
- _groupB = new PoolGroup
53
- {
54
- id = "GroupB",
55
- entries = new List<PoolEntry>
56
- {
57
- new PoolEntry
58
- {
59
- id = "PrefabB",
60
- prefab = _prefabB,
61
- prewarmCount = 5
62
- }
63
- }
64
- };
65
-
66
- _pool.RegisterGroup(_groupA, _spawnParentA);
67
- _pool.RegisterGroup(_groupB, _spawnParentB);
68
- }
69
-
70
- [TearDown]
71
- public void TearDown()
72
- {
73
- if (_pool != null)
74
- {
75
- _pool.DestroyPool();
76
- UnityObject.DestroyImmediate(_pool.gameObject);
77
- }
78
-
79
- if (_spawnParentA != null)
80
- {
81
- UnityObject.DestroyImmediate(_spawnParentA.gameObject);
82
- }
83
-
84
- if (_spawnParentB != null)
85
- {
86
- UnityObject.DestroyImmediate(_spawnParentB.gameObject);
87
- }
88
-
89
- if (_prefabA != null)
90
- {
91
- UnityObject.DestroyImmediate(_prefabA);
92
- }
93
-
94
- if (_prefabB != null)
95
- {
96
- UnityObject.DestroyImmediate(_prefabB);
97
- }
98
-
99
- var allObjects = UnityObject.FindObjectsOfType<GameObject>();
100
- foreach (var obj in allObjects)
101
- {
102
- if (obj.hideFlags == HideFlags.DontSave)
103
- {
104
- UnityObject.DestroyImmediate(obj);
105
- }
106
- }
107
- }
108
-
109
- [UnityTest]
110
- public IEnumerator PoolGroupIsolation_MultipleGroups_ObjectsNeverCrossBetweenGroups()
111
- {
112
- yield return _pool.Initialize();
113
-
114
- for (int i = 0; i < 100; i++)
115
- {
116
- var objFromA = _groupA.Get("PrefabA");
117
- Assert.IsNotNull(objFromA, $"Iteration {i}: GroupA should return valid GameObject");
118
-
119
- var objFromB = _groupB.Get("PrefabB");
120
- Assert.IsNotNull(objFromB, $"Iteration {i}: GroupB should return valid GameObject");
121
-
122
- var instanceIdA = objFromA.GetInstanceID();
123
- var instanceIdB = objFromB.GetInstanceID();
124
-
125
- Assert.AreNotEqual(instanceIdA, instanceIdB,
126
- $"Iteration {i}: Objects from different groups should have different instance IDs");
127
-
128
- Assert.IsTrue(objFromA.name.Contains("PrefabA"),
129
- $"Iteration {i}: Object from GroupA should be PrefabA instance");
130
- Assert.IsTrue(objFromB.name.Contains("PrefabB"),
131
- $"Iteration {i}: Object from GroupB should be PrefabB instance");
132
-
133
- _groupA.Return(objFromA);
134
- _groupB.Return(objFromB);
135
-
136
- var reusedFromA = _groupA.Get("PrefabA");
137
- var reusedFromB = _groupB.Get("PrefabB");
138
-
139
- Assert.AreEqual(instanceIdA, reusedFromA.GetInstanceID(),
140
- $"Iteration {i}: GroupA should reuse its own objects");
141
- Assert.AreEqual(instanceIdB, reusedFromB.GetInstanceID(),
142
- $"Iteration {i}: GroupB should reuse its own objects");
143
-
144
- Assert.IsTrue(reusedFromA.name.Contains("PrefabA"),
145
- $"Iteration {i}: GroupA should never return PrefabB instances");
146
- Assert.IsTrue(reusedFromB.name.Contains("PrefabB"),
147
- $"Iteration {i}: GroupB should never return PrefabA instances");
148
-
149
- _groupA.Return(reusedFromA);
150
- _groupB.Return(reusedFromB);
151
- }
152
- }
153
-
154
- [UnityTest]
155
- public IEnumerator ReturnGroupRouting_ReturnToGroup_SubsequentGetRetrievesSameInstanceFromSameGroup()
156
- {
157
- yield return _pool.Initialize();
158
-
159
- for (int i = 0; i < 100; i++)
160
- {
161
- var objA1 = _groupA.Get("PrefabA");
162
- var objA2 = _groupA.Get("PrefabA");
163
- var objB1 = _groupB.Get("PrefabB");
164
- var objB2 = _groupB.Get("PrefabB");
165
-
166
- Assert.IsNotNull(objA1, $"Iteration {i}: GroupA Get 1 should return valid GameObject");
167
- Assert.IsNotNull(objA2, $"Iteration {i}: GroupA Get 2 should return valid GameObject");
168
- Assert.IsNotNull(objB1, $"Iteration {i}: GroupB Get 1 should return valid GameObject");
169
- Assert.IsNotNull(objB2, $"Iteration {i}: GroupB Get 2 should return valid GameObject");
170
-
171
- var instanceIdA1 = objA1.GetInstanceID();
172
- var instanceIdA2 = objA2.GetInstanceID();
173
- var instanceIdB1 = objB1.GetInstanceID();
174
- var instanceIdB2 = objB2.GetInstanceID();
175
-
176
- _groupA.Return(objA1);
177
- _groupA.Return(objA2);
178
- _groupB.Return(objB1);
179
- _groupB.Return(objB2);
180
-
181
- var reusedA1 = _groupA.Get("PrefabA");
182
- var reusedA2 = _groupA.Get("PrefabA");
183
- var reusedB1 = _groupB.Get("PrefabB");
184
- var reusedB2 = _groupB.Get("PrefabB");
185
-
186
- var reusedInstanceIdsA = new HashSet<int>
187
- {
188
- reusedA1.GetInstanceID(),
189
- reusedA2.GetInstanceID()
190
- };
191
- var reusedInstanceIdsB = new HashSet<int>
192
- {
193
- reusedB1.GetInstanceID(),
194
- reusedB2.GetInstanceID()
195
- };
196
-
197
- Assert.IsTrue(reusedInstanceIdsA.Contains(instanceIdA1),
198
- $"Iteration {i}: Object returned to GroupA should be retrieved from GroupA");
199
- Assert.IsTrue(reusedInstanceIdsA.Contains(instanceIdA2),
200
- $"Iteration {i}: Object returned to GroupA should be retrieved from GroupA");
201
-
202
- Assert.IsTrue(reusedInstanceIdsB.Contains(instanceIdB1),
203
- $"Iteration {i}: Object returned to GroupB should be retrieved from GroupB");
204
- Assert.IsTrue(reusedInstanceIdsB.Contains(instanceIdB2),
205
- $"Iteration {i}: Object returned to GroupB should be retrieved from GroupB");
206
-
207
- Assert.IsFalse(reusedInstanceIdsA.Contains(instanceIdB1),
208
- $"Iteration {i}: GroupA should not return objects from GroupB");
209
- Assert.IsFalse(reusedInstanceIdsA.Contains(instanceIdB2),
210
- $"Iteration {i}: GroupA should not return objects from GroupB");
211
-
212
- Assert.IsFalse(reusedInstanceIdsB.Contains(instanceIdA1),
213
- $"Iteration {i}: GroupB should not return objects from GroupA");
214
- Assert.IsFalse(reusedInstanceIdsB.Contains(instanceIdA2),
215
- $"Iteration {i}: GroupB should not return objects from GroupA");
216
-
217
- _groupA.Return(reusedA1);
218
- _groupA.Return(reusedA2);
219
- _groupB.Return(reusedB1);
220
- _groupB.Return(reusedB2);
221
- }
222
- }
223
- }
224
- }
@@ -1,11 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 52ad4e4f94f0b41ff9df7f00bcbdd701
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
@@ -1,257 +0,0 @@
1
- using System.Collections;
2
- using NUnit.Framework;
3
- using UnityEngine;
4
- using UnityEngine.TestTools;
5
- using UnityObject = UnityEngine.Object;
6
-
7
- namespace Amanotes.Core
8
- {
9
- public class PrefabPoolLifecycleTests
10
- {
11
- private PrefabPool _pool;
12
- private GameObject _testPrefab;
13
- private PoolGroup _testGroup;
14
- private Transform _spawnParent;
15
-
16
- [SetUp]
17
- public void SetUp()
18
- {
19
- var poolObject = new GameObject("TestPool");
20
- _pool = poolObject.AddComponent<PrefabPool>();
21
-
22
- var spawnParentObject = new GameObject("SpawnParent");
23
- _spawnParent = spawnParentObject.transform;
24
-
25
- _testPrefab = new GameObject("TestPrefab");
26
- _testPrefab.AddComponent<MockPoolPrefab>();
27
-
28
- _testGroup = new PoolGroup
29
- {
30
- id = "TestGroup",
31
- entries = new System.Collections.Generic.List<PoolEntry>
32
- {
33
- new PoolEntry
34
- {
35
- id = "TestPrefab",
36
- prefab = _testPrefab,
37
- prewarmCount = 5
38
- }
39
- }
40
- };
41
-
42
- _pool.RegisterGroup(_testGroup, _spawnParent);
43
- }
44
-
45
- [TearDown]
46
- public void TearDown()
47
- {
48
- if (_pool != null)
49
- {
50
- _pool.DestroyPool();
51
- UnityObject.DestroyImmediate(_pool.gameObject);
52
- }
53
-
54
- if (_spawnParent != null)
55
- {
56
- UnityObject.DestroyImmediate(_spawnParent.gameObject);
57
- }
58
-
59
- if (_testPrefab != null)
60
- {
61
- UnityObject.DestroyImmediate(_testPrefab);
62
- }
63
-
64
- var allObjects = UnityObject.FindObjectsOfType<GameObject>();
65
- foreach (var obj in allObjects)
66
- {
67
- if (obj.hideFlags == HideFlags.DontSave)
68
- {
69
- UnityObject.DestroyImmediate(obj);
70
- }
71
- }
72
- }
73
-
74
- [UnityTest]
75
- public IEnumerator PoolObjectRoundTrip_GetReturnGet_ReuseSameInstance()
76
- {
77
- yield return _pool.Initialize();
78
-
79
- for (int i = 0; i < 100; i++)
80
- {
81
- var firstGet = _testGroup.Get("TestPrefab");
82
- Assert.IsNotNull(firstGet, $"Iteration {i}: First Get should return valid GameObject");
83
-
84
- var firstInstanceId = firstGet.GetInstanceID();
85
-
86
- _testGroup.Return(firstGet);
87
-
88
- var secondGet = _testGroup.Get("TestPrefab");
89
- Assert.IsNotNull(secondGet, $"Iteration {i}: Second Get should return valid GameObject");
90
-
91
- var secondInstanceId = secondGet.GetInstanceID();
92
-
93
- Assert.AreEqual(firstInstanceId, secondInstanceId,
94
- $"Iteration {i}: Get-Return-Get should reuse same instance (validates pooling eliminates instantiation)");
95
-
96
- _testGroup.Return(secondGet);
97
- }
98
- }
99
-
100
- [UnityTest]
101
- public IEnumerator LifecycleCallbackInvocation_GetReturnCycle_InvokesOnGetAndOnReturnExactlyOnce()
102
- {
103
- yield return _pool.Initialize();
104
-
105
- for (int i = 0; i < 100; i++)
106
- {
107
- var obj = _testGroup.Get("TestPrefab");
108
- Assert.IsNotNull(obj, $"Iteration {i}: Get should return valid GameObject");
109
-
110
- var mock = obj.GetComponent<MockPoolPrefab>();
111
- Assert.IsNotNull(mock, $"Iteration {i}: GameObject should have MockPoolPrefab component");
112
-
113
- mock.ResetCounts();
114
-
115
- var objAgain = _testGroup.Get("TestPrefab");
116
- var mockAgain = objAgain.GetComponent<MockPoolPrefab>();
117
- mockAgain.ResetCounts();
118
-
119
- _testGroup.Return(obj);
120
-
121
- Assert.AreEqual(1, mock.returnCallCount,
122
- $"Iteration {i}: OnReturn should be called exactly once during Return");
123
- Assert.AreEqual(0, mock.getCallCount,
124
- $"Iteration {i}: OnGet should not be called during Return");
125
-
126
- var reusedObj = _testGroup.Get("TestPrefab");
127
- var reusedMock = reusedObj.GetComponent<MockPoolPrefab>();
128
-
129
- Assert.AreEqual(1, reusedMock.getCallCount,
130
- $"Iteration {i}: OnGet should be called exactly once during Get");
131
-
132
- _testGroup.Return(objAgain);
133
- _testGroup.Return(reusedObj);
134
- }
135
- }
136
-
137
- [UnityTest]
138
- public IEnumerator PreallocationCorrectness_PrewarmCount_CreatesExactNumberOfPreallocatedObjects()
139
- {
140
- for (int iteration = 0; iteration < 100; iteration++)
141
- {
142
- var prewarmCount = UnityEngine.Random.Range(1, 20);
143
-
144
- var poolObject = new GameObject($"TestPool_{iteration}");
145
- var pool = poolObject.AddComponent<PrefabPool>();
146
-
147
- var spawnParentObject = new GameObject($"SpawnParent_{iteration}");
148
- var spawnParent = spawnParentObject.transform;
149
-
150
- var prefab = new GameObject($"Prefab_{iteration}");
151
- prefab.AddComponent<MockPoolPrefab>();
152
-
153
- var group = new PoolGroup
154
- {
155
- id = $"Group_{iteration}",
156
- entries = new System.Collections.Generic.List<PoolEntry>
157
- {
158
- new PoolEntry
159
- {
160
- id = "TestPrefab",
161
- prefab = prefab,
162
- prewarmCount = prewarmCount
163
- }
164
- }
165
- };
166
-
167
- pool.RegisterGroup(group, spawnParent);
168
-
169
- yield return pool.Initialize();
170
-
171
- var retrievedObjects = new System.Collections.Generic.List<GameObject>();
172
-
173
- for (int i = 0; i < prewarmCount; i++)
174
- {
175
- var obj = group.Get("TestPrefab");
176
- Assert.IsNotNull(obj, $"Iteration {iteration}: Should retrieve pre-allocated object {i}");
177
- retrievedObjects.Add(obj);
178
- }
179
-
180
- Assert.AreEqual(prewarmCount, retrievedObjects.Count,
181
- $"Iteration {iteration}: Should retrieve exactly {prewarmCount} pre-allocated objects");
182
-
183
- foreach (var obj in retrievedObjects)
184
- {
185
- group.Return(obj);
186
- }
187
-
188
- pool.DestroyPool();
189
- UnityObject.DestroyImmediate(poolObject);
190
- UnityObject.DestroyImmediate(spawnParentObject);
191
- UnityObject.DestroyImmediate(prefab);
192
- }
193
- }
194
-
195
- [UnityTest]
196
- public IEnumerator DynamicPoolExpansion_GetBeyondCapacity_SuccessfullyReturnsValidGameObjects()
197
- {
198
- for (int iteration = 0; iteration < 100; iteration++)
199
- {
200
- var initialCapacity = UnityEngine.Random.Range(2, 10);
201
- var extraRequests = UnityEngine.Random.Range(5, 15);
202
-
203
- var poolObject = new GameObject($"TestPool_{iteration}");
204
- var pool = poolObject.AddComponent<PrefabPool>();
205
-
206
- var spawnParentObject = new GameObject($"SpawnParent_{iteration}");
207
- var spawnParent = spawnParentObject.transform;
208
-
209
- var prefab = new GameObject($"Prefab_{iteration}");
210
- prefab.AddComponent<MockPoolPrefab>();
211
-
212
- var group = new PoolGroup
213
- {
214
- id = $"Group_{iteration}",
215
- entries = new System.Collections.Generic.List<PoolEntry>
216
- {
217
- new PoolEntry
218
- {
219
- id = "TestPrefab",
220
- prefab = prefab,
221
- prewarmCount = initialCapacity
222
- }
223
- }
224
- };
225
-
226
- pool.RegisterGroup(group, spawnParent);
227
-
228
- yield return pool.Initialize();
229
-
230
- var retrievedObjects = new System.Collections.Generic.List<GameObject>();
231
-
232
- var totalRequests = initialCapacity + extraRequests;
233
-
234
- for (int i = 0; i < totalRequests; i++)
235
- {
236
- var obj = group.Get("TestPrefab");
237
- Assert.IsNotNull(obj,
238
- $"Iteration {iteration}: Get beyond capacity should succeed (request {i + 1}/{totalRequests})");
239
- retrievedObjects.Add(obj);
240
- }
241
-
242
- Assert.AreEqual(totalRequests, retrievedObjects.Count,
243
- $"Iteration {iteration}: Should retrieve {totalRequests} objects (capacity {initialCapacity} + expansion {extraRequests})");
244
-
245
- foreach (var obj in retrievedObjects)
246
- {
247
- group.Return(obj);
248
- }
249
-
250
- pool.DestroyPool();
251
- UnityObject.DestroyImmediate(poolObject);
252
- UnityObject.DestroyImmediate(spawnParentObject);
253
- UnityObject.DestroyImmediate(prefab);
254
- }
255
- }
256
- }
257
- }
@@ -1,212 +0,0 @@
1
- using System.Collections;
2
- using NUnit.Framework;
3
- using Unity.PerformanceTesting;
4
- using UnityEngine;
5
- using UnityEngine.TestTools;
6
- using UnityObject = UnityEngine.Object;
7
-
8
- namespace Amanotes.Core
9
- {
10
- public class PrefabPoolPerformanceTests
11
- {
12
- private PrefabPool _pool;
13
- private GameObject _testPrefab;
14
- private PoolGroup _testGroup;
15
- private Transform _spawnParent;
16
-
17
- [SetUp]
18
- public void SetUp()
19
- {
20
- var poolObject = new GameObject("TestPool");
21
- _pool = poolObject.AddComponent<PrefabPool>();
22
-
23
- var spawnParentObject = new GameObject("SpawnParent");
24
- _spawnParent = spawnParentObject.transform;
25
-
26
- _testPrefab = new GameObject("TestPrefab");
27
- _testPrefab.AddComponent<MockPoolPrefab>();
28
-
29
- _testGroup = new PoolGroup
30
- {
31
- id = "TestGroup",
32
- entries = new System.Collections.Generic.List<PoolEntry>
33
- {
34
- new PoolEntry
35
- {
36
- id = "TestPrefab",
37
- prefab = _testPrefab,
38
- prewarmCount = 10
39
- }
40
- }
41
- };
42
-
43
- _pool.RegisterGroup(_testGroup, _spawnParent);
44
- }
45
-
46
- [TearDown]
47
- public void TearDown()
48
- {
49
- if (_pool != null)
50
- {
51
- _pool.DestroyPool();
52
- UnityObject.DestroyImmediate(_pool.gameObject);
53
- }
54
-
55
- if (_spawnParent != null)
56
- {
57
- UnityObject.DestroyImmediate(_spawnParent.gameObject);
58
- }
59
-
60
- if (_testPrefab != null)
61
- {
62
- UnityObject.DestroyImmediate(_testPrefab);
63
- }
64
-
65
- var allObjects = UnityObject.FindObjectsOfType<GameObject>();
66
- foreach (var obj in allObjects)
67
- {
68
- if (obj.hideFlags == HideFlags.DontSave)
69
- {
70
- UnityObject.DestroyImmediate(obj);
71
- }
72
- }
73
- }
74
-
75
- [UnityTest, Performance]
76
- public IEnumerator Performance_GetReturnCycles()
77
- {
78
- yield return _pool.Initialize();
79
-
80
- Measure.Method(() =>
81
- {
82
- for (int i = 0; i < 1000; i++)
83
- {
84
- var obj = _testGroup.Get("TestPrefab");
85
- _testGroup.Return(obj);
86
- }
87
- })
88
- .WarmupCount(5)
89
- .MeasurementCount(10)
90
- .IterationsPerMeasurement(1)
91
- .GC()
92
- .Run();
93
- }
94
-
95
- [UnityTest, Performance]
96
- public IEnumerator Performance_GCAllocation()
97
- {
98
- yield return _pool.Initialize();
99
-
100
- Measure.Method(() =>
101
- {
102
- for (int i = 0; i < 100; i++)
103
- {
104
- var obj = _testGroup.Get("TestPrefab");
105
- _testGroup.Return(obj);
106
- }
107
- })
108
- .WarmupCount(5)
109
- .MeasurementCount(10)
110
- .IterationsPerMeasurement(1)
111
- .GC()
112
- .Run();
113
- }
114
-
115
- [UnityTest, Performance]
116
- public IEnumerator Performance_PoolExpansion()
117
- {
118
- yield return _pool.Initialize();
119
-
120
- var retrievedObjects = new System.Collections.Generic.List<GameObject>();
121
-
122
- for (int i = 0; i < 10; i++)
123
- {
124
- var obj = _testGroup.Get("TestPrefab");
125
- retrievedObjects.Add(obj);
126
- }
127
-
128
- Measure.Method(() =>
129
- {
130
- for (int i = 0; i < 100; i++)
131
- {
132
- var obj = _testGroup.Get("TestPrefab");
133
- retrievedObjects.Add(obj);
134
- }
135
- })
136
- .WarmupCount(2)
137
- .MeasurementCount(10)
138
- .IterationsPerMeasurement(1)
139
- .GC()
140
- .Run();
141
-
142
- foreach (var obj in retrievedObjects)
143
- {
144
- _testGroup.Return(obj);
145
- }
146
- }
147
-
148
- [UnityTest, Performance]
149
- public IEnumerator Performance_ParentTransformOverhead()
150
- {
151
- yield return _pool.Initialize();
152
-
153
- var withParentTime = 0.0;
154
- var withoutParentTime = 0.0;
155
-
156
- Measure.Method(() =>
157
- {
158
- for (int i = 0; i < 100; i++)
159
- {
160
- var obj = _testGroup.Get("TestPrefab");
161
- _testGroup.Return(obj);
162
- }
163
- })
164
- .WarmupCount(5)
165
- .MeasurementCount(10)
166
- .IterationsPerMeasurement(1)
167
- .GC()
168
- .Run();
169
-
170
- var poolObjectNoParent = new GameObject("TestPoolNoParent");
171
- var poolNoParent = poolObjectNoParent.AddComponent<PrefabPool>();
172
-
173
- var prefabNoParent = new GameObject("TestPrefabNoParent");
174
- prefabNoParent.AddComponent<MockPoolPrefab>();
175
-
176
- var groupNoParent = new PoolGroup
177
- {
178
- id = "TestGroupNoParent",
179
- entries = new System.Collections.Generic.List<PoolEntry>
180
- {
181
- new PoolEntry
182
- {
183
- id = "TestPrefab",
184
- prefab = prefabNoParent,
185
- prewarmCount = 10
186
- }
187
- }
188
- };
189
-
190
- poolNoParent.RegisterGroup(groupNoParent, null);
191
- yield return poolNoParent.Initialize();
192
-
193
- Measure.Method(() =>
194
- {
195
- for (int i = 0; i < 100; i++)
196
- {
197
- var obj = groupNoParent.Get("TestPrefab");
198
- groupNoParent.Return(obj);
199
- }
200
- })
201
- .WarmupCount(5)
202
- .MeasurementCount(10)
203
- .IterationsPerMeasurement(1)
204
- .GC()
205
- .Run();
206
-
207
- poolNoParent.DestroyPool();
208
- UnityObject.DestroyImmediate(poolObjectNoParent);
209
- UnityObject.DestroyImmediate(prefabNoParent);
210
- }
211
- }
212
- }
@@ -1,11 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 16aa39925a01643c3894a56145c56a21
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
@@ -1,14 +0,0 @@
1
- using NUnit.Framework;
2
- using Amanotes.Core;
3
-
4
- namespace Amanotes.Core
5
- {
6
- public class PrefabPoolTestsSetup
7
- {
8
- [Test]
9
- public void TestInfrastructureVerification()
10
- {
11
- Assert.IsTrue(true, "PrefabPool test infrastructure is working");
12
- }
13
- }
14
- }
@@ -1,11 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: e61f89af128b84b429ac96d86bd0554f
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
@@ -1,26 +0,0 @@
1
- using UnityEngine;
2
-
3
- namespace Amanotes.Core
4
- {
5
- public class MockPoolPrefab : MonoBehaviour, IPoolPrefab
6
- {
7
- public int getCallCount;
8
- public int returnCallCount;
9
-
10
- public void OnGet()
11
- {
12
- getCallCount++;
13
- }
14
-
15
- public void OnReturn()
16
- {
17
- returnCallCount++;
18
- }
19
-
20
- public void ResetCounts()
21
- {
22
- getCallCount = 0;
23
- returnCallCount = 0;
24
- }
25
- }
26
- }
@@ -1,11 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 8e7402f0e0f2440338429ebbb480ffc3
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
@@ -1,8 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 2ce9db2584cc4444f930d1ab257afcaf
3
- folderAsset: yes
4
- DefaultImporter:
5
- externalObjects: {}
6
- userData:
7
- assetBundleName:
8
- assetBundleVariant:
@@ -1,8 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: f4d670095ee40448b93f6f5dbc2c07e6
3
- folderAsset: yes
4
- DefaultImporter:
5
- externalObjects: {}
6
- userData:
7
- assetBundleName:
8
- assetBundleVariant:
package/Tests.meta DELETED
@@ -1,8 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 518067fd8d1ac4415b0468af746cce4a
3
- folderAsset: yes
4
- DefaultImporter:
5
- externalObjects: {}
6
- userData:
7
- assetBundleName:
8
- assetBundleVariant: