So, I am using Network.Instantiate() and Network.Destroy() to create/destroy objects with my multiplayer game.
If the server calls Network.Instantiate() and then a client connects later on, that object will be created on the client as expected. This is great.
However... If the server creates the object with Network.Instantiate() and then destroys that object with Network.Destroy() and then the client connects, that object will still be created on the client! This is very bad!
From my understanding, what is causing this problem is that the buffered RPCs created with Network.Instantiate() are not removed with Network.Destroy(). Is this is a bug or intended functionality?
The only solution I can think of is to create a unique RPC Group for every object that is Network.Instantiated and then calling Network.RemoveRPCsInGroup() for that unique RPC Group in that object's OnDisable()... if(networkView.isMine)
However, this will not work because of the (undocumented?) limit of 32 RPC groups. My game will certainly have more than 32 objects created over the course of a round.
My desired functionality is for Network.Destroy() to remove the buffered RPCs that were created with the corresponding Network.Instantiate()
This seems very reasonable...
A practical example problem:
ServerA starts a game.
ClientA connects.
The ServerA player and ClientA player start shooting at each other. 500 bullets are created with Network.Instantiate. Of those, only 3 are currently still flying (the rest have been destroyed with Network.Destroy().
ClientB connects. All 500 bullets are immediately created on ClientB's screen (instead of just the desired 3).
I am working on example project to demo this now.
Sadly, if there is no solution to this I don't think I can continue with Unity development as this is a critical issue :(