Skip to content

Commit af7b2b3

Browse files
committed
optimize the scene order
1 parent 501b7e2 commit af7b2b3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Assets/CustomTools/ObjectPooling/Scripts/ObjectPool/ObjectPooler.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ public void Despawn(GameObject obj)
9898
PoolDictionary[tag].Enqueue(obj);
9999

100100
IPooledObject iPooledObj = obj.GetComponent<IPooledObject>();
101-
if (iPooledObj != null) iPooledObj.OnObjectDespawn();
101+
if (iPooledObj != null)
102+
{
103+
iPooledObj.OnObjectDespawn();
104+
}
105+
obj.transform.SetParent(_poolMasters[tag]);
102106
obj.SetActive(false);
103107

104108

0 commit comments

Comments
 (0)