Enemies shoot Bullet(pooled)

Hello,
In a shmup, I have an enemy shooting bullets. (good start ! :slight_smile: )
This bullet is pooled and useable by several enemies.
Now i want another bullets but i don’t know the best solution :

  1. create another bullet with another go pooler
    or
  2. add another sprite in the current go bullet and then activate the desired sprite when the bullet is active. So in this case, no need to create another pooler ?

Having multiple pools won’t hurt. But if the question is about the performance, usually the answer is to try the easiest solution, and think about the optimization if there is a problem. Premature optimization is the mother of all evil! :smiley:

Usually, I’m using this implementation myself: Resource Manager and Object Pooling – Anton Semchenko

This implementation uses different pools for different prefabs. One thing to keep in mind is that all of the referenced prefabs will be loaded to memory as soon as the scene with the ResourceManager is loaded. It might be a problem if prefabs are big.

This is and interesting way to manage pools ! Thank you.
What do you think about my idea to deal with bullets ? Different aspect (sprites) but using the same bullet prefab ?

  • Add another sprite in the current go bullet and then activate the desired sprite when the bullet is active

if it works, i can only have one bullet prefab for multiples bullet aspect.
e.g. having only 1 bullet prefab (with 5 sprites) and 1 pooler instead of 5 bullet prefabs and 5 pools.

And another question :slight_smile: :
I a bullet is only use by one gameobject (a boss), is it good to make the objpool a child of the boss ?

Setting up the shooting, and the ownership of the bullets that are created, is really what this blog is about. When the bullet is created, a few variables need to be updated, such as the owner and the direction the bullet is moving myprepaidcenter