@@ -5,7 +5,7 @@ Object Pooling for Unity
55- Faster in terms of performance than Instantiate/Destroy (Test at the end of README)
66- Easy to use
77- Easy to integrate with already written spawn systems
8- - Callbacks OnSpawn & OnDespawn for resseting after object being used
8+ - Callbacks OnGet & OnRelease for resseting after object being used
99
1010## How to Install
1111### Git Installation (Best way to get latest version)
@@ -53,10 +53,10 @@ public class Spawner : MonoBehaviour
5353
5454 public void Spawn ()
5555 {
56- _prefab .Spawn (transform .position , transform .rotation );
56+ _prefab .Get (transform .position , transform .rotation );
5757
5858 // Get object from pool with component
59- _prefab .Spawn <Rigidbody >(transform .position , transform .rotation ).isKinematic = true ;
59+ _prefab .Get <Rigidbody >(transform .position , transform .rotation ).isKinematic = true ;
6060 }
6161}
6262```
@@ -72,8 +72,8 @@ public class Spawner : MonoBehaviour
7272
7373 public void Spawn ()
7474 {
75- var instance = _prefab .Spawn (transform .position , transform .rotation );
76- instance .Despawn ();
75+ var instance = _prefab .Get (transform .position , transform .rotation );
76+ instance .Release ();
7777 }
7878}
7979```
@@ -93,11 +93,11 @@ public class Health : MonoBehaviour, IPoolable
9393 _health = _maxHealth ;
9494
9595 // IPoolable method
96- public void OnSpawn () =>
96+ public void OnGet () =>
9797 _health = _maxHealth ;
9898
9999 // IPoolable method
100- public void OnDespawn () { }
100+ public void OnRelease () { }
101101}
102102```
103103
@@ -134,7 +134,7 @@ public class Tester : MonoBehaviour
134134```
135135##### Result: [ 16:26:15] Milliseconds: 6
136136
137- #### Spawn/Despawn :
137+ #### Get/Release :
138138
139139``` csharp
140140using Sirenix .OdinInspector ;
@@ -159,8 +159,8 @@ public class Tester : MonoBehaviour
159159
160160 for (int i = 0 ; i < 1000 ; i ++ )
161161 {
162- var instance = _object .Spawn ();
163- instance .Despawn ();
162+ var instance = _object .Get ();
163+ instance .Release ();
164164 }
165165
166166 stopwatch .Stop ();
0 commit comments