how can I deleate and allwasy keep 10 clones? I mean I put this : private void Awake() { _pool = new ObjectPool(CreateProjectile , null ,OnPutBackInPool,defaultCapacity:10); } this is the method to control the maximum size of the pool right? I put 10... the problem is I see in my hierachy an accumulative objects (clones) by 10... the first time I shoot not matter , the pool deleates everything, the problem is when I pass 10, they are increaseing the number in +10...adn at the end of the day I ve a lot of Clones in the hierachy...some are deleated of course...but never keeps 10 !
Its not the max size of the pool, its the initial pool capacity. That means, when the pool is created it will allocated space for 10 objects. If you spawn more, it will increase the capacity of the pool. If you know you are going to have a certain amount of bullets at the same time, put that number as the default capacity :).
@@obviousgame I followed your tutorial , I ve created a similar class, I meant I also have a Class for weapon, but it is strange for me, when I put 10 to allocated only ten objects, always add 10 more to the first 10...probably I also reduce the time of lifeTime but it is the same for me..I am missaunderstood ? thaks.
best explanation of how to use the feature so far. Thanks!
good explanation man, thanks very much
v nice , keep it up
how can I deleate and allwasy keep 10 clones? I mean I put this :
private void Awake()
{
_pool = new ObjectPool(CreateProjectile , null ,OnPutBackInPool,defaultCapacity:10);
}
this is the method to control the maximum size of the pool right? I put 10... the problem is I see in my hierachy an accumulative objects (clones) by 10... the first time I shoot not matter , the pool deleates everything, the problem is when I pass 10, they are increaseing the number in +10...adn at the end of the day I ve a lot of Clones in the hierachy...some are deleated of course...but never keeps 10 !
Its not the max size of the pool, its the initial pool capacity. That means, when the pool is created it will allocated space for 10 objects. If you spawn more, it will increase the capacity of the pool. If you know you are going to have a certain amount of bullets at the same time, put that number as the default capacity :).
@@obviousgame I followed your tutorial , I ve created a similar class, I meant I also have a Class for weapon, but it is strange for me, when I put 10 to allocated only ten objects, always add 10 more to the first 10...probably I also reduce the time of lifeTime but it is the same for me..I am missaunderstood ? thaks.
@@AstralNostalgia If you come on the discord channel and post some screenshots maybe I can help you better ;)