How to do Object Pooling in Unity Networking HLAPI?

Hey guys!

I am attempting to build a solid object pooling system within the Unity Networking system, but I’m really struggling with this.

How I’m trying to do is creating all the objects needed for the object pool all at once as soon as the Server is up. I would also like to also keep types of objects separate from one another.

(example: [Projectiles (bullet_1, bullet_2, bullet_2)],

[Particles (hitParts, explosionParts)] etc.)

They need to be easily accessible from all players and ideally all players in the game accessing the exact same object pool with the same objects.

Maybe that is the wrong way to go about it? I was also thinking that each player might have to create its own object pool and use that, but I am just not sure if that is the way to go about it!

Do you guys have any examples or tips or how to’s on how to achieve something like this, or at the very least get me started?

Thanks ahead of time!

http://docs.unity3d.com/Manual/UNetCustomSpawning.html

Scroll down to Setting up an object pool with custom spawn handlers.
I am using this approach to implement pooled monsters and it works nicely.

1 Like

Hey thanks! I actually got it working with by having each player use its own object pool instead of what I originally wanted which seems to work fine!