Deleting RPC objects

Hi. I’ve been faced with a bug that stops me from coding and that’s how when I instanite an object through rpc’s to all (on server mode) I get a lot of errors when deleting it! So could I do an rpc delete? I don’t even know if that’s a thing but is there a way for me to delete an object called on every clients! Also the unity manual on this made no sence to me. Also if I instanite an object that is a network view when I delete other clients say something like missing network view and they start to crash! So yeah help me.

If all clients aren’t synced with the exact same set of NetworkViews then each time a NetworkView tries to send a message you will get an error.

You can stop the errors by sending a custom RPC delete to each of clients to destroy it before destroying it on the host.

You may still get a few errors between the time the clients receive the RPC and the host deletes the NetworkView. These may or may not be ignorable depending on your setup. If they are not ignorable then to get rid of these errors completely you’ll need to do an RPC ‘handshake’. First the host disables the object and tells the clients to delete via an RPC. Then each of the clients tells the host they have deleted it using another RPC. When all the clients have reported in, the host then deletes the object on its side.

I’m not sure if UnityEngine.Network.Destroy(NetworkViewID) does the handshake automatically for you, but try using that before writing your custom RPCs as it may save you the effort.