Search Unity

Network.Destroy and RPC buffer

Discussion in 'Multiplayer' started by seb, Oct 17, 2008.

  1. seb

    seb

    Joined:
    Oct 3, 2008
    Posts:
    7
    Hi all!

    Ok, Maybe there is something i am doing the wrong way in my code, but it seems that RPC calls buffered on Network.Instantiate are not removed from the RPC buffer by calling Network.Destroy.

    Players that connect after an object has been network destroyed do receive the RPC call for something that does not exist any more. Is it the expected behavior ? Is there something I should be aware of?

    Thanks for your help!

    Sebastien
     
  2. ProtonOne

    ProtonOne

    Joined:
    Mar 8, 2008
    Posts:
    406
    You need to clear out the RPC buffer for that player:

    Code (csharp):
    1. function OnPlayerDisconnected(player: NetworkPlayer) {
    2.    Debug.Log("Clean up after player " + player);
    3.    Network.RemoveRPCs(player);
    4.    Network.DestroyPlayerObjects(player);
    5. }
    file://localhost/Applications/Unity/Unity.app/Contents/Documentation/Documentation/ScriptReference/Network.OnPlayerDisconnected.html