|
Post by Heath Close on Mar 16, 2017 23:18:58 GMT
I wanted to limit the amount of bullets that can be fired and on the screen so I lowered the amount pool boss instantiates, but when I call for more bullets by clicking when all the bullets are already spawned, the editor pauses with an error saying there are no more in the pool... which is what I want... sans the error...
is there a better way to achieve this? one that isn't seen as an error? is the error a preference that can be shut off?
|
|
|
Post by DarkTonic Dev on Mar 17, 2017 1:51:35 GMT
You can't shut it off, but you can check if there are available clones left before you spawn. I'm pretty reluctant to make the error turn-off-able because that is an actual error condition in my view. You can program around it though so it doesn't happen.
var cloneToSpawn = PoolBoss.NextPoolItemToSpawn ( Transform transformTospawn ); if (cloneToSpawn == null) { // then don't spawn anything. Return from method. return; }
// else spawn it. PoolBoss.SpawnInPool(transformTospawn, yadda, yadda);
The editor only pauses if you've turned on Pause On Error. A lot of people, me included, do not, except for when we're trying to fix something.
I will add to the roadmap to change the error to tell you how to check this like the code above. However, if it's not your own code that is spawning things (using our spawners instead), then there's no way around it. It will log the error. You will need to avoid it by increasing the pool size at it says. Or change the wave size.
There's also a "Recycle oldest" option you could turn on, but I personally would never use that option. It would basically make your bullet teleport from elsewhere back to your gun when it shoots a new one and there are none left.
|
|