Sending a gameobject over network with RPC?


I am having the exact same problem as this post: Buffered RPCs from Network.Instantiate() not removed on Network.Destroy()? - Questions & Answers - Unity Discussions
I’ve also read the RPC details:

So there I read the answer AngryOldMan, which sounds like a good solution. The problem is, I can’t send GameObjects using RPC calls (“not supported” in unity the error says).
How do I solve this then if I cant send the objects?

For example, here’s what my clients execute:

    public void ClientKillFrog(GameObject frog)
            // send a request to the server to kill a gameobject
		networkView.RPC("OnClientKillFrog",RPCMode.Server, frog);
	void OnServerKillFrog(GameObject frog)
           // server has ack'd a clients need to kill a gameobject

And here’s the server:

	void OnClientKillFrog(GameObject frog,NetworkMessageInfo info) 

UPDATE: OK, solution by jet.c works in some cases, but I have one more problem: When I have a server running and 1 client playing, killing and spawning some frogs, then when another client connects I get this:

View ID AllocatedID: 1 not found during lookup. Strange behaviour may occur
Couldn't perform remote Network.Destroy because the network view 'AllocatedID: 1' could not be located.

I assume this is because the newly connected client tries to perform Network.Destroy on objects already destroyed for everyone else, so the server crashes. How do you handle this?

Rather than sending a GameObject through the RPC, try sending its NetworkViewID instead.

Turns out you can have a GameObject parameter in an Rpc or Command function (see the Arguments to Remote Actions section). The GameObject must have a NetworkIdentity component, so it must either be in the scene when the application runs or after it is instantiated then it must be spawned with NetworkServer.Spawn.