Skip to content

Commit 2701f78

Browse files
Update README.md
1 parent 9319b51 commit 2701f78

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
1-
# UnityAsset_ObjectPoolingSystem
2-
Unity asset for an object pooling system.
1+
FretBuzzObjectPool
2+
3+
This asset will be used to get and return objects from and to the pool providing reusability and automatic creation of the object if the pool is empty.
4+
You can use this asset for reusability of your objects.
5+
6+
7+
-------- ObjectPool<T>
8+
9+
ObjectPool(string a_strObjectType, int a_iStartSize = 0)
10+
11+
where a_strObjectType is the typeof(T)
12+
a_iStartSize is the size of the pooled objects
13+
14+
Pool.getObject() returns a object of type T from the pool and sets it to active.
15+
Pool.returnToPool(T obj) to return the object to the pool and deactivates the object.
16+
Pool.returnAll() to return all objects back into the pool and deactivates all the object.
17+
18+
-------- IReusable
19+
20+
The reusable object of type T should be derived from IReusable
21+
-- T.onRetrievedFromPool()
22+
will be called when the object is retrieved from the pool.
23+
-- T.onReturnedToPool()
24+
will be called when the object is returned to the pool.
25+
26+
27+
28+
-------- MonoObjectPool<T>
29+
To use an object pool for MonoBehaviour objects, use
30+
31+
MonoObjectPool<T>(T a_Prefab, GameObject a_Parent, int a_iStartSize = 0)
32+
33+
where T is the prefab to manage
34+
a_Parent is the gameobject which will act as the parent gameobject of the instantiated gameobjects of type T
35+
a_iStartSize is the amount of gameobjects of type T that will be instantiated on start

0 commit comments

Comments
 (0)