var projectile = Network.Instantiate(RPG, transform.position, transform.rotation, 0);
Then within the script attached to the RPG I have code to destroy the gameObject 2 seconds after it has hit the ground with -
networkView.RPC("killRPG", RPCMode.AllBuffered);
@RPC
function killRPG(){
Destroy(gameObject);
}
But the problem is sometime I get the error - View ID AllocatedID: 156 not found during lookup. Strange behaviour may occur I presume that a package gets through to the server before the gameObject is destroyed, is there a better way of destroying the gameObject over the network ?
I am very interested to know if this actually worked for you Griffo.
As I am having very similar problems:
I have a player gameObject which is Netwrok instantiated by the client. This player gameObject transmits data via RPCâs to the server).
When i destroy this object on the server, the player gameObject is still transmitting data to the server, until the command is reached to the clientâs game instance to destroy this object.
The problem is that during this time a situation arises where the player gameObject is transmitting data while on the server itâs already destroyed, giving rise to âCouldnât invoke RPC errorâ on the server itself.
The machine that spawned/ownes the object (usually the server) needs to perform the delete to keep it from updating other machines that would have already deleted their local copy otherwise. This could be done without significant changes to existing code by clients sending a âDestroyRequestâ message to the server and having the server call Network.Destroy rather than calling it directly on the client.