diff --git a/Assets/CustomTools/ObjectPooling/Scripts/ObjectPool/ObjectPooler.cs b/Assets/CustomTools/ObjectPooling/Scripts/ObjectPool/ObjectPooler.cs index d65c17e..81f5406 100644 --- a/Assets/CustomTools/ObjectPooling/Scripts/ObjectPool/ObjectPooler.cs +++ b/Assets/CustomTools/ObjectPooling/Scripts/ObjectPool/ObjectPooler.cs @@ -56,7 +56,7 @@ private void Start() } - public GameObject SpawnFromPool(PooledObjectType tag, Vector3 pos, Quaternion rot) + public GameObject SpawnFromPool(PooledObjectType tag, Vector3 pos, Quaternion rot, GameObject parent = null) { if (!PoolDictionary.ContainsKey(tag)) @@ -86,6 +86,11 @@ public GameObject SpawnFromPool(PooledObjectType tag, Vector3 pos, Quaternion ro objToSpawn = ExpandPool(tag, pos, rot); } + if (parent) + { + objToSpawn.transform.SetParent(parent.transform); + } + return objToSpawn; }