magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Dec 28, 2018 1:12:51 GMT
Is there a built-in way to cleanly despawn any residual prefabs when a level is completed? I have a setup where the final wave consists of a boss enemy and some repeating enemy spawns. I have lots of repeats so that the small enemies will continue to spawn while the boss is alive. But I am forcibly ending the wave when the boss dies by calling LevelSettings.EndWave(). However, this means that there might still be a few straggling enemies coming along. So what happens is that the next level/wave starts and these stragglers are still flying around. So, I'm looking for some way to despawn these stragglers.
I tried PoolBoss.DespawnAllPrefabs and this works, but in this case it causes a problem. My player ship is also a spawn and I don't want it to despawn when going from level to level. So, I was hoping there was a way to just have the Spawners despawn what they've spawned and not to touch the player spawn that I manually spawned through code. But I don't see anything on the spawners to despawn the prefabs that they spawned.
|
|
|
Post by DarkTonic Dev on Dec 28, 2018 1:32:56 GMT
Yeah that's what Despawn all prefabs is for. If you want some to stick around then despawn certain categories instead. Like enemies and enemy projectiles etc.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Dec 28, 2018 1:51:02 GMT
Oh, I didn't realize you could despawn only certain categories. I'll give it a try. Thanks.
|
|
|
Post by DarkTonic Dev on Dec 28, 2018 1:52:23 GMT
Okay sounds good.
|
|