Answer the question
In order to leave comments, you need to log in
What is the best way to make a pool of objects in a unit?
When you need to frequently spawn a lot of objects, instead of instantiate and destroy, it is better to enable, move, adjust and disable ready-made objects on the stage. Unity's official tutorial says:
public GameObject GetPooledObject()
{
for(int i=0; i < amountToPool; i++)
{
if(!pooledObjects[i].activeInHierarchy)
{
return pooledObjects[i]
}
}
return null;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question