Is Object Pooling Possible?

bug 717122 filed on this.

"De-spawning a server object with NetworkServer.UnSpawn() does not cleanup the object properly to allow it to be respawned with NetworkServer.Spawn(). This function should set the networkId of the object back to zero so that it can be Spawned again.

Also calling NetworkServer.UnSpawn() on an object that was never spawned gives a nullReference exception instead of an error message."

2 Likes

How I reset my netId for network game objects that is already in the scene, I mean, for objects that not spawned?

When a player disconnects, how do i tell the server to Unspawn all objects from pools related to that player?

Hi guys, thanks to your comments and other threads in the forums I was able to make my own implementation of a networking object pooling system.
You can check it out here and try it out, I hope you like it:
http://www.justjuank.com/network-object-pooling-for-unity3d/
Sorry if this is an old thread, just wanted to share it with you.

Juan

4 Likes

This page in the documentation is really useful:

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

Check the section Setting up an object pool with custom spawn handlers

1 Like

How did you handle the rotations? I mean when you spawn the object your delegate gets the position to set, but no rotation.
How can I configure the right way the object out from the pool?
The objects I’m pooling don’t have synced transform

Why when using this way http://docs.unity3d.com/Manual/UNetCustomSpawning.html on the host everything works as expected the spawned bullets are put back in the pool and deactivated, but on the clients the spawned bullets are added to the scene then deactivated and left there adding up with each bullet?