Hello,
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: http://unity3d.com/support/documentation/Components/net-RPCDetails.html
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);
}
[RPC]
void OnServerKillFrog(GameObject frog)
{
// server has ack'd a clients need to kill a gameobject
Destroy(frog);
}
And here’s the server:
[RPC]
void OnClientKillFrog(GameObject frog,NetworkMessageInfo info)
{
Debug.Log("OnClientKillFrog");
networkView.RPC("OnServerKillFrog",RPCMode.AllBuffered,frog);
}
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?
btw. The question you refer to is outdated. Back these days there wasn't a <a href="http://unity3d.com/support/documentation/ScriptReference/Network.RemoveRPCs.html">Network.RemoveRPCs</a> that takes a NetworkViewID as parameter. This function has been introduced in Unity 3.2 as you can read here: <a href="http://unity3d.com/unity/whats-new/unity-3.2">UpdateNotes Unity 3.2</a>(see "Other Improvements"). So you also have to be careful with tutorials before that release since there has been invented a lot complicated workarounds.
– Bunny83I see, big thanks
– anon62807076