Skip to content

Commit a6b9030

Browse files
committed
FIX : Leak on expansion fixed.
1 parent 11b34f9 commit a6b9030

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Assets/Scripts/ObjectPool/ObjectPooler.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ private GameObject ExpandPool(PooledObjectType tag, Vector3 pos, Quaternion rot)
108108
temp.transform.position = pos;
109109
temp.transform.rotation = rot;
110110

111+
if (temp.GetComponent<IPooledObject>() == null)
112+
{
113+
PooledObject tempPool = temp.AddComponent<PooledObject>();
114+
tempPool.Type = tag;
115+
}
116+
111117
IPooledObject iPooledObj = temp.GetComponent<IPooledObject>();
112118
iPooledObj.Init();
113119
iPooledObj.OnObjectSpawn();

0 commit comments

Comments
 (0)