Skip to content

Commit

Permalink
set parent on spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
ertanturan committed Mar 30, 2020
1 parent 9e0d2a2 commit d8eb397
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit d8eb397

Please sign in to comment.